Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Unified Diff: pkg/analyzer/test/src/summary/summary_common.dart

Issue 1699243003: Serialize and resynthesize unresolved constant instance creations. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add more tests. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/summary/summary_common.dart
diff --git a/pkg/analyzer/test/src/summary/summary_common.dart b/pkg/analyzer/test/src/summary/summary_common.dart
index ecacfe5de588e699616885e0840e3574ad13a2d5..5e2f084a858189de7f3dd0751212ee6dea90f964 100644
--- a/pkg/analyzer/test/src/summary/summary_common.dart
+++ b/pkg/analyzer/test/src/summary/summary_common.dart
@@ -594,6 +594,7 @@ abstract class SummaryTest {
: expectation.relativeUri ?? relativeUri,
expectation.name,
expectedKind: expectation.kind,
+ checkAstDerivedDataOverride: checkAstDerivedDataOverride,
expectedTargetUnit: expectedTargetUnit,
linkedSourceUnit: linkedSourceUnit,
unlinkedSourceUnit: unlinkedSourceUnit,
@@ -1969,6 +1970,123 @@ const v = const p.C();
]);
}
+ test_constExpr_invokeConstructor_unresolved_named() {
+ UnlinkedVariable variable = serializeVariableText(
+ '''
+class C {}
+const v = const C.foo();
+''',
+ allowErrors: true);
+ _assertUnlinkedConst(variable.constExpr, operators: [
+ UnlinkedConstOperation.invokeConstructor,
+ ], ints: [
+ 0,
+ 0
+ ], referenceValidators: [
+ (EntityRef r) => checkTypeRef(r, null, null, 'foo',
+ expectedKind: ReferenceKind.unresolved,
+ checkAstDerivedDataOverride: true,
+ prefixExpectations: [
+ new _PrefixExpectation(ReferenceKind.classOrEnum, 'C')
+ ])
+ ]);
+ }
+
+ test_constExpr_invokeConstructor_unresolved_named2() {
+ UnlinkedVariable variable = serializeVariableText(
+ '''
+const v = const C.foo();
+''',
+ allowErrors: true);
+ _assertUnlinkedConst(variable.constExpr, operators: [
+ UnlinkedConstOperation.invokeConstructor,
+ ], ints: [
+ 0,
+ 0
+ ], referenceValidators: [
+ (EntityRef r) => checkTypeRef(r, null, null, 'foo',
+ expectedKind: ReferenceKind.unresolved,
+ checkAstDerivedDataOverride: true,
+ prefixExpectations: [
+ new _PrefixExpectation(ReferenceKind.unresolved, 'C')
+ ])
+ ]);
+ }
+
+ test_constExpr_invokeConstructor_unresolved_named_prefixed() {
+ addNamedSource(
+ '/a.dart',
+ '''
+class C {
+}
+''');
+ UnlinkedVariable variable = serializeVariableText(
+ '''
+import 'a.dart' as p;
+const v = const p.C.foo();
+''',
+ allowErrors: true);
+ _assertUnlinkedConst(variable.constExpr, operators: [
+ UnlinkedConstOperation.invokeConstructor,
+ ], ints: [
+ 0,
+ 0
+ ], referenceValidators: [
+ (EntityRef r) => checkTypeRef(r, null, null, 'foo',
+ expectedKind: ReferenceKind.unresolved,
+ checkAstDerivedDataOverride: true,
+ prefixExpectations: [
+ new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
+ absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'),
+ new _PrefixExpectation(ReferenceKind.prefix, 'p',
+ inLibraryDefiningUnit: true)
+ ])
+ ]);
+ }
+
+ test_constExpr_invokeConstructor_unresolved_named_prefixed2() {
+ addNamedSource('/a.dart', '');
+ UnlinkedVariable variable = serializeVariableText(
+ '''
+import 'a.dart' as p;
+const v = const p.C.foo();
+''',
+ allowErrors: true);
+ _assertUnlinkedConst(variable.constExpr, operators: [
+ UnlinkedConstOperation.invokeConstructor,
+ ], ints: [
+ 0,
+ 0
+ ], referenceValidators: [
+ (EntityRef r) => checkTypeRef(r, null, null, 'foo',
+ expectedKind: ReferenceKind.unresolved,
+ checkAstDerivedDataOverride: true,
+ prefixExpectations: [
+ new _PrefixExpectation(ReferenceKind.unresolved, 'C'),
+ new _PrefixExpectation(ReferenceKind.prefix, 'p',
+ inLibraryDefiningUnit: true)
+ ])
+ ]);
+ }
+
+ test_constExpr_invokeConstructor_unresolved_unnamed() {
+ UnlinkedVariable variable = serializeVariableText(
+ '''
+const v = const Foo();
+''',
+ allowErrors: true);
+ _assertUnlinkedConst(variable.constExpr, operators: [
+ UnlinkedConstOperation.invokeConstructor,
+ ], ints: [
+ 0,
+ 0
+ ], referenceValidators: [
+ (EntityRef r) => checkTypeRef(r, null, null, 'Foo',
+ expectedKind: ReferenceKind.unresolved,
+ checkAstDerivedDataOverride: true)
+ ]);
+ }
+
test_constExpr_length_classConstField() {
UnlinkedVariable variable = serializeVariableText('''
class C {
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698