diff options
author | cushon <cushon@google.com> | 2018-04-13 11:17:49 -0700 |
---|---|---|
committer | Liam Miller-Cushon <cushon@google.com> | 2018-06-12 19:44:43 -0700 |
commit | c1f59b1b0c4327c186ee84e4087b3926affd3302 (patch) | |
tree | 7d3db7582f2fc5c7d20d1e10ae01725fe6f1be14 /javatests | |
parent | 822abecd8b08182f75dfb807214b531ba0708bd5 (diff) | |
download | turbine-c1f59b1b0c4327c186ee84e4087b3926affd3302.tar.gz |
Don't report an error if a static type import cannot be resolved
Single-type imports are allowed to be static, but if they are they
cannot be distinguished from member imports until members are resolved.
If a static import cannot be processed during type resolution, assume it
was a non-type member instead of reporting an error.
MOE_MIGRATED_REVID=192795814
Diffstat (limited to 'javatests')
3 files changed, 22 insertions, 3 deletions
diff --git a/javatests/com/google/turbine/binder/BinderErrorTest.java b/javatests/com/google/turbine/binder/BinderErrorTest.java index 06088ab..4cf378e 100644 --- a/javatests/com/google/turbine/binder/BinderErrorTest.java +++ b/javatests/com/google/turbine/binder/BinderErrorTest.java @@ -186,9 +186,9 @@ public class BinderErrorTest { "}", }, { - "<>:2: error: symbol not found java.util.List$NoSuch", // - "import static java.util.List.NoSuch;", - " ^" + "<>:3: error: could not resolve NoSuch", // + "public class Test extends NoSuch {", + " ^" }, }, { diff --git a/javatests/com/google/turbine/lower/LowerIntegrationTest.java b/javatests/com/google/turbine/lower/LowerIntegrationTest.java index 698627c..6496756 100644 --- a/javatests/com/google/turbine/lower/LowerIntegrationTest.java +++ b/javatests/com/google/turbine/lower/LowerIntegrationTest.java @@ -302,6 +302,7 @@ public class LowerIntegrationTest { "B70953542.test", // TODO(cushon): support for source level 9 in integration tests // "B74332665.test", + "memberimport.test", }; List<Object[]> tests = ImmutableList.copyOf(testCases).stream().map(x -> new Object[] {x}).collect(toList()); diff --git a/javatests/com/google/turbine/lower/testdata/memberimport.test b/javatests/com/google/turbine/lower/testdata/memberimport.test new file mode 100644 index 0000000..c32220a --- /dev/null +++ b/javatests/com/google/turbine/lower/testdata/memberimport.test @@ -0,0 +1,18 @@ +=== A.java === +package a; +public class A { + // this is not a field + // | this is a field + // | | + // v v + public static final Object Object = new Object() {}; +} +=== B.java === +package b; +import static a.A.Object; // <-- this is a field +class B { + public static final Object x = null; + // ^ + // | + // this is not a field +} |