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

Unified Diff: tests/compiler/dart2js/resolver_test.dart

Issue 2846433003: Run closed_world2_test using the normal compiler pipeline. (Closed)
Patch Set: Updated cf. comments Created 3 years, 8 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 | « tests/compiler/dart2js/related_types_test.dart ('k') | tests/compiler/dart2js/source_map_name_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/resolver_test.dart
diff --git a/tests/compiler/dart2js/resolver_test.dart b/tests/compiler/dart2js/resolver_test.dart
index fe8151ecb459c3f277a1dd6b89645d4f9b4b0c7e..1f4ef06e1a9936f964925c94d05d197af25dd73b 100644
--- a/tests/compiler/dart2js/resolver_test.dart
+++ b/tests/compiler/dart2js/resolver_test.dart
@@ -117,9 +117,10 @@ class B extends A implements J1, J2 {}
class C extends B implements L1 {}
""");
compiler.resolveStatement("C c;");
- ClassElement classA = compiler.mainApp.find("A");
- ClassElement classB = compiler.mainApp.find("B");
- ClassElement classC = compiler.mainApp.find("C");
+ LibraryElement mainApp = compiler.mainApp;
+ ClassElement classA = mainApp.find("A");
+ ClassElement classB = mainApp.find("B");
+ ClassElement classC = mainApp.find("C");
Expect.equals('[ I2, I1, Object ]', classA.allSupertypes.toString());
Expect.equals('[ A, J2, J1, I2, I1, K2, K1, Object ]',
classB.allSupertypes.toString());
@@ -133,7 +134,8 @@ class Foo extends X<Foo> {}
class Bar extends Foo implements X<Bar> {}
""");
compiler.resolveStatement("Bar bar;");
- ClassElement classBar = compiler.mainApp.find("Bar");
+ LibraryElement mainApp = compiler.mainApp;
+ ClassElement classBar = mainApp.find("Bar");
DiagnosticCollector collector = compiler.diagnosticCollector;
Expect.equals(0, collector.warnings.length);
Expect.equals(1, collector.errors.length);
@@ -166,7 +168,8 @@ Future testTypeVariables() {
MockCompiler.create((MockCompiler compiler) {
ResolverVisitor visitor = compiler.resolverVisitor();
compiler.parseScript('class Foo<T, U> {}');
- ClassElement foo = compiler.mainApp.find('Foo');
+ LibraryElement mainApp = compiler.mainApp;
+ ClassElement foo = mainApp.find('Foo');
matchResolvedTypes(visitor, 'Foo<int, String> x;', 'Foo', [
compiler.commonElements.intClass,
compiler.commonElements.stringClass
@@ -197,7 +200,8 @@ Future testTypeVariables() {
' foo(Foo<T> f) {}'
' bar() { g(Foo<T> f) {}; g(); }'
'}');
- ClassElement foo = compiler.mainApp.find('Foo');
+ LibraryElement mainApp = compiler.mainApp;
+ ClassElement foo = mainApp.find('Foo');
foo.ensureResolved(compiler.resolution);
MemberElement tMember = foo.lookupLocalMember('t');
tMember.computeType(compiler.resolution);
@@ -218,9 +222,10 @@ Future testSuperCalls() {
compiler.parseScript(script);
compiler.resolveStatement("B b;");
- ClassElement classB = compiler.mainApp.find("B");
+ LibraryElement mainApp = compiler.mainApp;
+ ClassElement classB = mainApp.find("B");
FunctionElement fooB = classB.lookupLocalMember("foo");
- ClassElement classA = compiler.mainApp.find("A");
+ ClassElement classA = mainApp.find("A");
FunctionElement fooA = classA.lookupLocalMember("foo");
ResolverVisitor visitor = new ResolverVisitor(
@@ -246,7 +251,8 @@ Future testSwitch() {
compiler.parseScript("class Foo { foo() {"
"switch (null) { case '': break; case 2: break; } } }");
compiler.resolveStatement("Foo foo;");
- ClassElement fooElement = compiler.mainApp.find("Foo");
+ LibraryElement mainApp = compiler.mainApp;
+ ClassElement fooElement = mainApp.find("Foo");
MethodElement funElement = fooElement.lookupLocalMember("foo");
compiler.enqueuer.resolution.applyImpact(new WorldImpactBuilderImpl()
..registerStaticUse(new StaticUse.implicitInvoke(funElement)));
@@ -270,7 +276,8 @@ Future testThis() {
MockCompiler.create((MockCompiler compiler) {
compiler.parseScript("class Foo { foo() { return this; } }");
compiler.resolveStatement("Foo foo;");
- ClassElement fooElement = compiler.mainApp.find("Foo");
+ LibraryElement mainApp = compiler.mainApp;
+ ClassElement fooElement = mainApp.find("Foo");
FunctionElement funElement = fooElement.lookupLocalMember("foo");
ResolverVisitor visitor = new ResolverVisitor(
compiler.resolution,
@@ -298,7 +305,8 @@ Future testThis() {
MockCompiler.create((MockCompiler compiler) {
compiler.parseScript("class Foo { static foo() { return this; } }");
compiler.resolveStatement("Foo foo;");
- ClassElement fooElement = compiler.mainApp.find("Foo");
+ LibraryElement mainApp = compiler.mainApp;
+ ClassElement fooElement = mainApp.find("Foo");
FunctionElement funElement = fooElement.lookupLocalMember("foo");
ResolverVisitor visitor = new ResolverVisitor(
compiler.resolution,
@@ -579,8 +587,9 @@ Future testSuperclass() {
Map mapping = compiler.resolveStatement("Foo bar;").map;
Expect.equals(1, mapping.length);
- ClassElement fooElement = compiler.mainApp.find('Foo');
- ClassElement barElement = compiler.mainApp.find('Bar');
+ LibraryElement mainApp = compiler.mainApp;
+ ClassElement fooElement = mainApp.find('Foo');
+ ClassElement barElement = mainApp.find('Bar');
Expect.equals(
barElement.computeType(compiler.resolution), fooElement.supertype);
Expect.isTrue(fooElement.interfaces.isEmpty);
@@ -626,8 +635,9 @@ Future testOneInterface() {
compiler.backend.target, new CollectingTreeElements(null)));
compiler.resolveStatement("Foo bar;");
- ClassElement fooElement = compiler.mainApp.find('Foo');
- ClassElement barElement = compiler.mainApp.find('Bar');
+ LibraryElement mainApp = compiler.mainApp;
+ ClassElement fooElement = mainApp.find('Foo');
+ ClassElement barElement = mainApp.find('Bar');
Expect.equals(null, barElement.supertype);
Expect.isTrue(barElement.interfaces.isEmpty);
@@ -645,9 +655,10 @@ Future testTwoInterfaces() {
class C implements I1, I2 {}""");
compiler.resolveStatement("Foo bar;");
- ClassElement c = compiler.mainApp.find('C');
- ClassElement i1 = compiler.mainApp.find('I1');
- ClassElement i2 = compiler.mainApp.find('I2');
+ LibraryElement mainApp = compiler.mainApp;
+ ClassElement c = mainApp.find('C');
+ ClassElement i1 = mainApp.find('I1');
+ ClassElement i2 = mainApp.find('I2');
Expect.equals(2, length(c.interfaces));
Expect.equals(i1.computeType(compiler.resolution), at(c.interfaces, 0));
@@ -676,9 +687,10 @@ Future testFunctionExpression() {
Future testNewExpression() {
return MockCompiler.create((MockCompiler compiler) {
compiler.parseScript("class A {} foo() { print(new A()); }");
- ClassElement aElement = compiler.mainApp.find('A');
+ LibraryElement mainApp = compiler.mainApp;
+ ClassElement aElement = mainApp.find('A');
- FunctionElement fooElement = compiler.mainApp.find('foo');
+ FunctionElement fooElement = mainApp.find('foo');
compiler.resolver.resolve(fooElement);
Expect.isNotNull(aElement);
@@ -699,7 +711,8 @@ Future testNewExpression() {
Future testTopLevelFields() {
return MockCompiler.create((MockCompiler compiler) {
compiler.parseScript("int a;");
- VariableElementX element = compiler.mainApp.find("a");
+ LibraryElement mainApp = compiler.mainApp;
+ VariableElementX element = mainApp.find("a");
Expect.equals(ElementKind.FIELD, element.kind);
VariableDefinitions node =
element.variables.parseNode(element, compiler.parsingContext);
@@ -708,8 +721,8 @@ Future testTopLevelFields() {
Expect.equals(typeName.source, 'int');
compiler.parseScript("var b, c;");
- VariableElementX bElement = compiler.mainApp.find("b");
- VariableElementX cElement = compiler.mainApp.find("c");
+ VariableElementX bElement = mainApp.find("b");
+ VariableElementX cElement = mainApp.find("c");
Expect.equals(ElementKind.FIELD, bElement.kind);
Expect.equals(ElementKind.FIELD, cElement.kind);
Expect.isTrue(bElement != cElement);
@@ -734,7 +747,8 @@ Future resolveConstructor(String script, String statement, String className,
return compiler.init().then((_) {
compiler.parseScript(script);
compiler.resolveStatement(statement);
- ClassElement classElement = compiler.mainApp.find(className);
+ LibraryElement mainApp = compiler.mainApp;
+ ClassElement classElement = mainApp.find(className);
Element element;
element = classElement.lookupConstructor(constructor);
FunctionExpression tree = (element as FunctionElement).node;
@@ -762,7 +776,8 @@ Future testClassHierarchy() {
MockCompiler.create((MockCompiler compiler) {
compiler.parseScript("""class A extends A {}
main() { return new A(); }""");
- FunctionElement mainElement = compiler.mainApp.find(MAIN);
+ LibraryElement mainApp = compiler.mainApp;
+ FunctionElement mainElement = mainApp.find(MAIN);
compiler.resolver.resolve(mainElement);
DiagnosticCollector collector = compiler.diagnosticCollector;
Expect.equals(0, collector.warnings.length);
@@ -774,7 +789,8 @@ Future testClassHierarchy() {
compiler.parseScript("""class A extends B {}
class B extends A {}
main() { return new A(); }""");
- FunctionElement mainElement = compiler.mainApp.find(MAIN);
+ LibraryElement mainApp = compiler.mainApp;
+ FunctionElement mainElement = mainApp.find(MAIN);
compiler.resolver.resolve(mainElement);
DiagnosticCollector collector = compiler.diagnosticCollector;
Expect.equals(0, collector.warnings.length);
@@ -789,7 +805,8 @@ Future testClassHierarchy() {
abstract class B extends A {}
class C implements A {}
main() { return new C(); }""");
- FunctionElement mainElement = compiler.mainApp.find(MAIN);
+ LibraryElement mainApp = compiler.mainApp;
+ FunctionElement mainElement = mainApp.find(MAIN);
compiler.resolver.resolve(mainElement);
DiagnosticCollector collector = compiler.diagnosticCollector;
Expect.equals(0, collector.warnings.length);
@@ -802,12 +819,13 @@ Future testClassHierarchy() {
class B extends C {}
class C {}
main() { return new A(); }""");
- FunctionElement mainElement = compiler.mainApp.find(MAIN);
+ LibraryElement mainApp = compiler.mainApp;
+ FunctionElement mainElement = mainApp.find(MAIN);
compiler.resolver.resolve(mainElement);
DiagnosticCollector collector = compiler.diagnosticCollector;
Expect.equals(0, collector.warnings.length);
Expect.equals(0, collector.errors.length);
- ClassElement aElement = compiler.mainApp.find("A");
+ ClassElement aElement = mainApp.find("A");
Link<InterfaceType> supertypes = aElement.allSupertypes;
Expect.equals(<String>['B', 'C', 'Object'].toString(),
asSortedStrings(supertypes).toString());
@@ -819,12 +837,13 @@ Future testClassHierarchy() {
class I<X,Y> {}
class C extends B<bool,String> {}
main() { return new C(); }""");
- FunctionElement mainElement = compiler.mainApp.find(MAIN);
+ LibraryElement mainApp = compiler.mainApp;
+ FunctionElement mainElement = mainApp.find(MAIN);
compiler.resolver.resolve(mainElement);
DiagnosticCollector collector = compiler.diagnosticCollector;
Expect.equals(0, collector.warnings.length);
Expect.equals(0, collector.errors.length);
- ClassElement aElement = compiler.mainApp.find("C");
+ ClassElement aElement = mainApp.find("C");
Link<InterfaceType> supertypes = aElement.allSupertypes;
// Object is once per inheritance path, that is from both A and I.
Expect.equals(
@@ -841,12 +860,13 @@ Future testClassHierarchy() {
class D extends A<E> {}
class E extends D {}
main() { return new E(); }""");
- FunctionElement mainElement = compiler.mainApp.find(MAIN);
+ LibraryElement mainApp = compiler.mainApp;
+ FunctionElement mainElement = mainApp.find(MAIN);
compiler.resolver.resolve(mainElement);
DiagnosticCollector collector = compiler.diagnosticCollector;
Expect.equals(0, collector.warnings.length);
Expect.equals(0, collector.errors.length);
- ClassElement aElement = compiler.mainApp.find("E");
+ ClassElement aElement = mainApp.find("E");
Link<InterfaceType> supertypes = aElement.allSupertypes;
Expect.equals(<String>['A<E>', 'D', 'Object'].toString(),
asSortedStrings(supertypes).toString());
@@ -855,7 +875,8 @@ Future testClassHierarchy() {
compiler.parseScript("""class A<T> {}
class D extends A<int> implements A<double> {}
main() { return new D(); }""");
- FunctionElement mainElement = compiler.mainApp.find(MAIN);
+ LibraryElement mainApp = compiler.mainApp;
+ FunctionElement mainElement = mainApp.find(MAIN);
compiler.resolver.resolve(mainElement);
DiagnosticCollector collector = compiler.diagnosticCollector;
Expect.equals(0, collector.warnings.length);
@@ -873,7 +894,8 @@ Future testEnumDeclaration() {
MockCompiler.create((MockCompiler compiler) {
compiler.parseScript("""enum Enum {}
main() { Enum e; }""");
- FunctionElement mainElement = compiler.mainApp.find(MAIN);
+ LibraryElement mainApp = compiler.mainApp;
+ FunctionElement mainElement = mainApp.find(MAIN);
compiler.resolver.resolve(mainElement);
DiagnosticCollector collector = compiler.diagnosticCollector;
Expect.equals(0, collector.warnings.length,
@@ -884,7 +906,8 @@ Future testEnumDeclaration() {
MockCompiler.create((MockCompiler compiler) {
compiler.parseScript("""enum Enum { A }
main() { Enum e = Enum.A; }""");
- FunctionElement mainElement = compiler.mainApp.find(MAIN);
+ LibraryElement mainApp = compiler.mainApp;
+ FunctionElement mainElement = mainApp.find(MAIN);
compiler.resolver.resolve(mainElement);
DiagnosticCollector collector = compiler.diagnosticCollector;
Expect.equals(0, collector.warnings.length,
@@ -895,7 +918,8 @@ Future testEnumDeclaration() {
MockCompiler.create((MockCompiler compiler) {
compiler.parseScript("""enum Enum { A }
main() { Enum e = Enum.B; }""");
- FunctionElement mainElement = compiler.mainApp.find(MAIN);
+ LibraryElement mainApp = compiler.mainApp;
+ FunctionElement mainElement = mainApp.find(MAIN);
compiler.resolver.resolve(mainElement);
DiagnosticCollector collector = compiler.diagnosticCollector;
Expect.equals(1, collector.warnings.length,
@@ -908,7 +932,8 @@ Future testEnumDeclaration() {
MockCompiler.create((MockCompiler compiler) {
compiler.parseScript("""enum Enum { A }
main() { List values = Enum.values; }""");
- FunctionElement mainElement = compiler.mainApp.find(MAIN);
+ LibraryElement mainApp = compiler.mainApp;
+ FunctionElement mainElement = mainApp.find(MAIN);
compiler.resolver.resolve(mainElement);
DiagnosticCollector collector = compiler.diagnosticCollector;
Expect.equals(0, collector.warnings.length,
@@ -919,7 +944,8 @@ Future testEnumDeclaration() {
MockCompiler.create((MockCompiler compiler) {
compiler.parseScript("""enum Enum { A }
main() { new Enum(0, ''); }""");
- FunctionElement mainElement = compiler.mainApp.find(MAIN);
+ LibraryElement mainApp = compiler.mainApp;
+ FunctionElement mainElement = mainApp.find(MAIN);
compiler.resolver.resolve(mainElement);
DiagnosticCollector collector = compiler.diagnosticCollector;
Expect.equals(0, collector.warnings.length,
@@ -932,7 +958,8 @@ Future testEnumDeclaration() {
MockCompiler.create((MockCompiler compiler) {
compiler.parseScript("""enum Enum { A }
main() { const Enum(0, ''); }""");
- FunctionElement mainElement = compiler.mainApp.find(MAIN);
+ LibraryElement mainApp = compiler.mainApp;
+ FunctionElement mainElement = mainApp.find(MAIN);
compiler.resolver.resolve(mainElement);
DiagnosticCollector collector = compiler.diagnosticCollector;
Expect.equals(0, collector.warnings.length,
« no previous file with comments | « tests/compiler/dart2js/related_types_test.dart ('k') | tests/compiler/dart2js/source_map_name_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698