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

Unified Diff: compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java

Issue 11110006: Issue 5735. Fix for 'export' without 'import' (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: If re-export if local element with same name exists Created 8 years, 2 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
Index: compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java b/compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java
index c13c42aa6b028425f360dc6d304a2c40bbbaf9c4..8f586e5bb3c488b911aff89fe0ba86039cc40daa 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java
@@ -716,6 +716,42 @@ public class IncrementalCompilation2Test extends CompilerTestCase {
""));
}
+ /**
+ * <p>
+ * http://code.google.com/p/dart/issues/detail?id=5735
+ */
+ public void test_importConflict_hideNoPrefix_importAgainWithPrefix() throws Exception {
+ appSource.setContent(
+ "A.dart",
+ makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler filler",
+ "library lib_a;",
+ "var E = 2.7;",
+ ""));
+ appSource.setContent(
+ "B.dart",
+ makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler filler",
+ "library lib_b;",
+ "export 'A.dart' show E;",
+ "var E = 'E';",
+ ""));
+ appSource.setContent(
+ APP,
+ makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler filler",
+ "library test.app;",
+ "import 'B.dart';",
+ "import 'A.dart' as M show E;",
+ "main() {",
+ " print(E);",
+ " print(M.E);",
+ "}",
+ ""));
+ compile();
+ assertErrors(errors);
+ }
+
public void test_reportMissingSource() throws Exception {
appSource.setContent(
APP,
@@ -1041,7 +1077,7 @@ public class IncrementalCompilation2Test extends CompilerTestCase {
assertErrors(errors, errEx(TypeErrorCode.NO_SUCH_TYPE, 7, 3, 10));
}
- public void test_newLibrarySyntax_export() throws Exception {
+ public void test_newLibrarySyntax_export_show() throws Exception {
appSource.setContent(
"A.dart",
makeCode(
@@ -1056,7 +1092,6 @@ public class IncrementalCompilation2Test extends CompilerTestCase {
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
"library test.B;",
- "import 'A.dart' as libA hide TypeAC;",
"export 'A.dart' show TypeAA, TypeAB;",
"class TypeBA {}",
"class TypeBB {}",
@@ -1088,6 +1123,52 @@ public class IncrementalCompilation2Test extends CompilerTestCase {
assertTrue(errors.toString().contains("libB.TypeBB"));
}
+ public void test_newLibrarySyntax_export_hide() throws Exception {
+ appSource.setContent(
+ "A.dart",
+ makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler filler",
+ "library test.A;",
+ "class TypeAA {}",
+ "class TypeAB {}",
+ "class TypeAC {}",
+ ""));
+ appSource.setContent(
+ "B.dart",
+ makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler filler",
+ "library test.B;",
+ "export 'A.dart' hide TypeAC;",
+ "class TypeBA {}",
+ "class TypeBB {}",
+ "class TypeBC {}",
+ ""));
+ appSource.setContent(
+ APP,
+ makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler filler",
+ "library test.app;",
+ "import 'B.dart' as libB hide TypeAA, TypeBB;",
+ "main() {",
+ " libB.TypeAA aa;",
+ " libB.TypeAB ab;",
+ " libB.TypeAC ac;",
+ " libB.TypeBA ba;",
+ " libB.TypeBB bb;",
+ " libB.TypeBC bc;",
+ "}",
+ ""));
+ compile();
+ assertErrors(
+ errors,
+ errEx(TypeErrorCode.NO_SUCH_TYPE, 5, 3, 11),
+ errEx(TypeErrorCode.NO_SUCH_TYPE, 7, 3, 11),
+ errEx(TypeErrorCode.NO_SUCH_TYPE, 9, 3, 11));
+ assertTrue(errors.toString().contains("libB.TypeAA"));
+ assertTrue(errors.toString().contains("libB.TypeAC"));
+ assertTrue(errors.toString().contains("libB.TypeBB"));
+ }
+
public void test_newLibrarySyntax_noExport() throws Exception {
appSource.setContent(
"A.dart",
« no previous file with comments | « compiler/java/com/google/dart/compiler/resolver/TopLevelElementBuilder.java ('k') | tests/co19/co19-compiler.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698