diff options
author | cushon <cushon@google.com> | 2019-01-25 11:27:32 -0800 |
---|---|---|
committer | Liam Miller-Cushon <cushon@google.com> | 2019-01-28 21:35:35 -0800 |
commit | c612ef98e6c5bf5eef7859289a52cf9f5711f62c (patch) | |
tree | ff7388692beda96c5bfa4e3df1ea3e9923fee6a1 /java/com/google | |
parent | 5f06705a31526d605fe767c46d0b10974a454d43 (diff) | |
download | turbine-c612ef98e6c5bf5eef7859289a52cf9f5711f62c.tar.gz |
Don't crash on type variables used as qualifiers in const exprs
MOE_MIGRATED_REVID=230937580
Diffstat (limited to 'java/com/google')
-rw-r--r-- | java/com/google/turbine/binder/ConstEvaluator.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/java/com/google/turbine/binder/ConstEvaluator.java b/java/com/google/turbine/binder/ConstEvaluator.java index 6db85e1..cfc63fc 100644 --- a/java/com/google/turbine/binder/ConstEvaluator.java +++ b/java/com/google/turbine/binder/ConstEvaluator.java @@ -35,6 +35,7 @@ import com.google.turbine.binder.lookup.MemberImportIndex; import com.google.turbine.binder.lookup.Scope; import com.google.turbine.binder.sym.ClassSymbol; import com.google.turbine.binder.sym.FieldSymbol; +import com.google.turbine.binder.sym.Symbol; import com.google.turbine.diag.SourceFile; import com.google.turbine.diag.TurbineError; import com.google.turbine.diag.TurbineError.ErrorKind; @@ -203,6 +204,9 @@ public strictfp class ConstEvaluator { if (result == null) { throw error(classTy.position(), ErrorKind.CANNOT_RESOLVE, flat.peekFirst()); } + if (result.sym().symKind() != Symbol.Kind.CLASS) { + throw error(classTy.position(), ErrorKind.UNEXPECTED_TYPE_PARAMETER, flat.peekFirst()); + } ClassSymbol classSym = (ClassSymbol) result.sym(); for (Ident bit : result.remaining()) { classSym = resolveNext(classTy.position(), classSym, bit); |