aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcushon <cushon@google.com>2018-11-06 15:23:48 -0800
committerLiam Miller-Cushon <cushon@google.com>2018-11-06 22:49:13 -0800
commit180ba7e85bd168ecb0f8cce2c2ae04f27c7f7d36 (patch)
tree06cbc937eff9eb9408c2251cf84c668815fc2c90
parentd60a47dc5e0e61143b4494ab337511a13e608d26 (diff)
downloadturbine-180ba7e85bd168ecb0f8cce2c2ae04f27c7f7d36.tar.gz
Model intersection types directly
and use them to represent type variable bounds. MOE_MIGRATED_REVID=220363183
-rw-r--r--java/com/google/turbine/binder/CanonicalTypeBinder.java11
-rw-r--r--java/com/google/turbine/binder/ConstBinder.java6
-rw-r--r--java/com/google/turbine/binder/TypeBinder.java27
-rw-r--r--java/com/google/turbine/binder/bound/TypeBoundClass.java23
-rw-r--r--java/com/google/turbine/binder/bytecode/BytecodeBoundClass.java10
-rw-r--r--java/com/google/turbine/lower/Lower.java24
-rw-r--r--java/com/google/turbine/lower/LowerSignature.java44
-rw-r--r--java/com/google/turbine/type/Type.java24
-rw-r--r--java/com/google/turbine/types/Canonicalize.java11
-rw-r--r--java/com/google/turbine/types/Erasure.java17
-rw-r--r--javatests/com/google/turbine/lower/LowerTest.java43
11 files changed, 137 insertions, 103 deletions
diff --git a/java/com/google/turbine/binder/CanonicalTypeBinder.java b/java/com/google/turbine/binder/CanonicalTypeBinder.java
index e7fed05..caeda97 100644
--- a/java/com/google/turbine/binder/CanonicalTypeBinder.java
+++ b/java/com/google/turbine/binder/CanonicalTypeBinder.java
@@ -30,6 +30,7 @@ import com.google.turbine.binder.sym.TyVarSymbol;
import com.google.turbine.diag.SourceFile;
import com.google.turbine.type.Type;
import com.google.turbine.type.Type.ClassTy;
+import com.google.turbine.type.Type.IntersectionTy;
import com.google.turbine.types.Canonicalize;
import java.util.Map;
@@ -153,14 +154,8 @@ public class CanonicalTypeBinder {
ImmutableMap.Builder<TyVarSymbol, TyVarInfo> result = ImmutableMap.builder();
for (Map.Entry<TyVarSymbol, TyVarInfo> e : tps.entrySet()) {
TyVarInfo info = e.getValue();
- Type superClassBound = null;
- if (info.superClassBound() != null) {
- superClassBound =
- Canonicalize.canonicalize(source, position, env, sym, info.superClassBound());
- }
- ImmutableList<Type> interfaceBounds =
- canonicalizeList(source, position, env, sym, info.interfaceBounds());
- result.put(e.getKey(), new TyVarInfo(superClassBound, interfaceBounds, info.annotations()));
+ Type bound = Canonicalize.canonicalize(source, position, env, sym, info.bound());
+ result.put(e.getKey(), new TyVarInfo((IntersectionTy) bound, info.annotations()));
}
return result.build();
}
diff --git a/java/com/google/turbine/binder/ConstBinder.java b/java/com/google/turbine/binder/ConstBinder.java
index 6852e23..0e81201 100644
--- a/java/com/google/turbine/binder/ConstBinder.java
+++ b/java/com/google/turbine/binder/ConstBinder.java
@@ -45,6 +45,7 @@ import com.google.turbine.type.Type;
import com.google.turbine.type.Type.ArrayTy;
import com.google.turbine.type.Type.ClassTy;
import com.google.turbine.type.Type.ClassTy.SimpleClassTy;
+import com.google.turbine.type.Type.IntersectionTy;
import com.google.turbine.type.Type.TyKind;
import com.google.turbine.type.Type.TyVar;
import com.google.turbine.type.Type.WildLowerBoundedTy;
@@ -293,8 +294,7 @@ public class ConstBinder {
result.put(
entry.getKey(),
new TyVarInfo(
- info.superClassBound() != null ? bindType(info.superClassBound()) : null,
- bindTypes(info.interfaceBounds()),
+ (IntersectionTy) bindType(info.bound()),
constEvaluator.evaluateAnnotations(info.annotations())));
}
return result.build();
@@ -333,6 +333,8 @@ public class ConstBinder {
case PRIM_TY:
case VOID_TY:
return type;
+ case INTERSECTION_TY:
+ return IntersectionTy.create(bindTypes(((IntersectionTy) type).bounds()));
default:
throw new AssertionError(type.tyKind());
}
diff --git a/java/com/google/turbine/binder/TypeBinder.java b/java/com/google/turbine/binder/TypeBinder.java
index 951a755..71c3f69 100644
--- a/java/com/google/turbine/binder/TypeBinder.java
+++ b/java/com/google/turbine/binder/TypeBinder.java
@@ -51,6 +51,7 @@ import com.google.turbine.tree.Tree.PrimTy;
import com.google.turbine.tree.TurbineModifier;
import com.google.turbine.type.AnnoInfo;
import com.google.turbine.type.Type;
+import com.google.turbine.type.Type.IntersectionTy;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.HashSet;
@@ -376,32 +377,20 @@ public class TypeBinder {
ImmutableMap.Builder<TyVarSymbol, TyVarInfo> result = ImmutableMap.builder();
for (Tree.TyParam tree : trees) {
TyVarSymbol sym = symbols.get(tree.name().value());
- Type classBound = null;
- ImmutableList.Builder<Type> interfaceBounds = ImmutableList.builder();
- boolean first = true;
- for (Tree bound : tree.bounds()) {
- Type ty = bindTy(scope, bound);
- if (first && !isInterface(ty)) {
- classBound = ty;
- } else {
- interfaceBounds.add(ty);
+ ImmutableList.Builder<Type> bounds = ImmutableList.builder();
+ if (tree.bounds().isEmpty()) {
+ bounds.add(Type.ClassTy.OBJECT);
+ } else {
+ for (Tree bound : tree.bounds()) {
+ bounds.add(bindTy(scope, bound));
}
- first = false;
}
ImmutableList<AnnoInfo> annotations = bindAnnotations(scope, tree.annos());
- result.put(sym, new TyVarInfo(classBound, interfaceBounds.build(), annotations));
+ result.put(sym, new TyVarInfo(IntersectionTy.create(bounds.build()), annotations));
}
return result.build();
}
- private boolean isInterface(Type ty) {
- if (ty.tyKind() != Type.TyKind.CLASS_TY) {
- return false;
- }
- HeaderBoundClass hi = env.get(((Type.ClassTy) ty).sym());
- return hi.kind() == TurbineTyKind.INTERFACE;
- }
-
private List<MethodInfo> bindMethods(CompoundScope scope, ImmutableList<Tree> members) {
List<MethodInfo> methods = new ArrayList<>();
for (Tree member : members) {
diff --git a/java/com/google/turbine/binder/bound/TypeBoundClass.java b/java/com/google/turbine/binder/bound/TypeBoundClass.java
index 8c36468..dc6bb43 100644
--- a/java/com/google/turbine/binder/bound/TypeBoundClass.java
+++ b/java/com/google/turbine/binder/bound/TypeBoundClass.java
@@ -27,6 +27,7 @@ import com.google.turbine.tree.Tree;
import com.google.turbine.tree.Tree.MethDecl;
import com.google.turbine.type.AnnoInfo;
import com.google.turbine.type.Type;
+import com.google.turbine.type.Type.IntersectionTy;
/** A bound node that augments {@link HeaderBoundClass} with type information. */
public interface TypeBoundClass extends HeaderBoundClass {
@@ -56,27 +57,17 @@ public interface TypeBoundClass extends HeaderBoundClass {
/** A type parameter declaration. */
class TyVarInfo {
- private final Type superClassBound;
- private final ImmutableList<Type> interfaceBounds;
+ private final IntersectionTy bound;
private final ImmutableList<AnnoInfo> annotations;
- public TyVarInfo(
- Type superClassBound,
- ImmutableList<Type> interfaceBounds,
- ImmutableList<AnnoInfo> annotations) {
- this.superClassBound = superClassBound;
- this.interfaceBounds = interfaceBounds;
+ public TyVarInfo(IntersectionTy bound, ImmutableList<AnnoInfo> annotations) {
+ this.bound = bound;
this.annotations = annotations;
}
- /** A class bound, or {@code null}. */
- public Type superClassBound() {
- return superClassBound;
- }
-
- /** Interface type bounds. */
- public ImmutableList<Type> interfaceBounds() {
- return interfaceBounds;
+ /** The bound. */
+ public IntersectionTy bound() {
+ return bound;
}
/** Type parameter declaration annotations. */
diff --git a/java/com/google/turbine/binder/bytecode/BytecodeBoundClass.java b/java/com/google/turbine/binder/bytecode/BytecodeBoundClass.java
index f801a14..e500302 100644
--- a/java/com/google/turbine/binder/bytecode/BytecodeBoundClass.java
+++ b/java/com/google/turbine/binder/bytecode/BytecodeBoundClass.java
@@ -54,6 +54,7 @@ import com.google.turbine.model.TurbineTyKind;
import com.google.turbine.type.AnnoInfo;
import com.google.turbine.type.Type;
import com.google.turbine.type.Type.ClassTy;
+import com.google.turbine.type.Type.IntersectionTy;
import java.lang.annotation.RetentionPolicy;
import java.util.Map;
import java.util.function.Function;
@@ -324,15 +325,14 @@ public class BytecodeBoundClass implements BoundClass, HeaderBoundClass, TypeBou
});
private static TyVarInfo bindTyParam(Sig.TyParamSig sig, Function<String, TyVarSymbol> scope) {
- Type superClassBound = null;
+ ImmutableList.Builder<Type> bounds = ImmutableList.builder();
if (sig.classBound() != null) {
- superClassBound = BytecodeBinder.bindTy(sig.classBound(), scope);
+ bounds.add(BytecodeBinder.bindTy(sig.classBound(), scope));
}
- ImmutableList.Builder<Type> interfaceBounds = ImmutableList.builder();
for (Sig.TySig t : sig.interfaceBounds()) {
- interfaceBounds.add(BytecodeBinder.bindTy(t, scope));
+ bounds.add(BytecodeBinder.bindTy(t, scope));
}
- return new TyVarInfo(superClassBound, interfaceBounds.build(), ImmutableList.of());
+ return new TyVarInfo(IntersectionTy.create(bounds.build()), ImmutableList.of());
}
@Override
diff --git a/java/com/google/turbine/lower/Lower.java b/java/com/google/turbine/lower/Lower.java
index 5ed646c..fe93a62 100644
--- a/java/com/google/turbine/lower/Lower.java
+++ b/java/com/google/turbine/lower/Lower.java
@@ -65,12 +65,14 @@ import com.google.turbine.diag.TurbineError;
import com.google.turbine.diag.TurbineError.ErrorKind;
import com.google.turbine.model.Const;
import com.google.turbine.model.TurbineFlag;
+import com.google.turbine.model.TurbineTyKind;
import com.google.turbine.model.TurbineVisibility;
import com.google.turbine.type.AnnoInfo;
import com.google.turbine.type.Type;
import com.google.turbine.type.Type.ArrayTy;
import com.google.turbine.type.Type.ClassTy;
import com.google.turbine.type.Type.ClassTy.SimpleClassTy;
+import com.google.turbine.type.Type.TyKind;
import com.google.turbine.type.Type.TyVar;
import com.google.turbine.type.Type.WildTy;
import com.google.turbine.types.Erasure;
@@ -236,7 +238,7 @@ public class Lower {
private byte[] lower(SourceTypeBoundClass info, ClassSymbol sym, Set<ClassSymbol> symbols) {
int access = classAccess(info);
String name = sig.descriptor(sym);
- String signature = sig.classSignature(info);
+ String signature = sig.classSignature(info, env);
String superName = info.superclass() != null ? sig.descriptor(info.superclass()) : null;
List<String> interfaces = new ArrayList<>();
for (ClassSymbol i : info.interfaces()) {
@@ -672,15 +674,12 @@ public class Lower {
TypePath.root(),
info));
}
- if (p.superClassBound() != null) {
- lowerTypeAnnotations(
- result,
- p.superClassBound(),
- boundTargetType,
- new TypeAnnotationInfo.TypeParameterBoundTarget(typeParameterIndex, 0));
- }
- int boundIndex = 1; // super class bound index is always 0; interface bounds start at 1
- for (Type i : p.interfaceBounds()) {
+ int boundIndex = 0;
+ for (Type i : p.bound().bounds()) {
+ if (boundIndex == 0 && isInterface(i, env)) {
+ // super class bound index is always 0; interface bounds start at 1
+ boundIndex++;
+ }
lowerTypeAnnotations(
result,
i,
@@ -691,6 +690,11 @@ public class Lower {
}
}
+ private boolean isInterface(Type type, Env<ClassSymbol, TypeBoundClass> env) {
+ return type.tyKind() == TyKind.CLASS_TY
+ && env.get(((ClassTy) type).sym()).kind() == TurbineTyKind.INTERFACE;
+ }
+
private void lowerTypeAnnotations(
Builder<TypeAnnotationInfo> result, Type type, TargetType targetType, Target target) {
new LowerTypeAnnotations(result, targetType, target)
diff --git a/java/com/google/turbine/lower/LowerSignature.java b/java/com/google/turbine/lower/LowerSignature.java
index 99a6f3f..624cbf8 100644
--- a/java/com/google/turbine/lower/LowerSignature.java
+++ b/java/com/google/turbine/lower/LowerSignature.java
@@ -19,6 +19,7 @@ package com.google.turbine.lower;
import com.google.common.collect.ImmutableList;
import com.google.turbine.binder.bound.SourceTypeBoundClass;
import com.google.turbine.binder.bound.TypeBoundClass;
+import com.google.turbine.binder.bound.TypeBoundClass.TyVarInfo;
import com.google.turbine.binder.env.Env;
import com.google.turbine.binder.sym.ClassSymbol;
import com.google.turbine.binder.sym.TyVarSymbol;
@@ -32,11 +33,13 @@ import com.google.turbine.bytecode.sig.Sig.TySig;
import com.google.turbine.bytecode.sig.Sig.UpperBoundTySig;
import com.google.turbine.bytecode.sig.SigWriter;
import com.google.turbine.model.TurbineFlag;
+import com.google.turbine.model.TurbineTyKind;
import com.google.turbine.type.Type;
import com.google.turbine.type.Type.ArrayTy;
import com.google.turbine.type.Type.ClassTy;
import com.google.turbine.type.Type.ClassTy.SimpleClassTy;
import com.google.turbine.type.Type.PrimTy;
+import com.google.turbine.type.Type.TyKind;
import com.google.turbine.type.Type.TyVar;
import com.google.turbine.type.Type.WildTy;
import java.util.Iterator;
@@ -141,7 +144,7 @@ public class LowerSignature {
if (!needsMethodSig(sym, env, method)) {
return null;
}
- ImmutableList<Sig.TyParamSig> typarams = tyParamSig(method.tyParams());
+ ImmutableList<Sig.TyParamSig> typarams = tyParamSig(method.tyParams(), env);
ImmutableList.Builder<Sig.TySig> fparams = ImmutableList.builder();
for (SourceTypeBoundClass.ParamInfo t : method.parameters()) {
if (t.synthetic()) {
@@ -203,11 +206,11 @@ public class LowerSignature {
* Produces a class signature attribute for a generic class, or {@code null} if the signature is
* unnecessary.
*/
- public String classSignature(SourceTypeBoundClass info) {
+ public String classSignature(SourceTypeBoundClass info, Env<ClassSymbol, TypeBoundClass> env) {
if (!classNeedsSig(info)) {
return null;
}
- ImmutableList<Sig.TyParamSig> typarams = tyParamSig(info.typeParameterTypes());
+ ImmutableList<Sig.TyParamSig> typarams = tyParamSig(info.typeParameterTypes(), env);
ClassTySig xtnd = null;
if (info.superClassType() != null) {
@@ -267,31 +270,46 @@ public class LowerSignature {
}
private ImmutableList<Sig.TyParamSig> tyParamSig(
- Map<TyVarSymbol, SourceTypeBoundClass.TyVarInfo> px) {
+ Map<TyVarSymbol, TyVarInfo> px, Env<ClassSymbol, TypeBoundClass> env) {
ImmutableList.Builder<Sig.TyParamSig> result = ImmutableList.builder();
for (Map.Entry<TyVarSymbol, SourceTypeBoundClass.TyVarInfo> entry : px.entrySet()) {
- result.add(tyParamSig(entry.getKey(), entry.getValue()));
+ result.add(tyParamSig(entry.getKey(), entry.getValue(), env));
}
return result.build();
}
- private Sig.TyParamSig tyParamSig(TyVarSymbol sym, SourceTypeBoundClass.TyVarInfo info) {
+ private Sig.TyParamSig tyParamSig(
+ TyVarSymbol sym, SourceTypeBoundClass.TyVarInfo info, Env<ClassSymbol, TypeBoundClass> env) {
+
String identifier = sym.name();
Sig.TySig cbound = null;
- if (info.superClassBound() != null) {
- cbound = signature(info.superClassBound());
- } else if (info.interfaceBounds().isEmpty()) {
+ ImmutableList.Builder<Sig.TySig> ibounds = ImmutableList.builder();
+ if (info.bound().bounds().isEmpty()) {
cbound =
new ClassTySig(
"java/lang", ImmutableList.of(new SimpleClassTySig("Object", ImmutableList.of())));
- }
- ImmutableList.Builder<Sig.TySig> ibounds = ImmutableList.builder();
- for (Type i : info.interfaceBounds()) {
- ibounds.add(signature(i));
+ } else {
+ boolean first = true;
+ for (Type bound : info.bound().bounds()) {
+ TySig sig = signature(bound);
+ if (first) {
+ if (!isInterface(bound, env)) {
+ cbound = sig;
+ continue;
+ }
+ }
+ ibounds.add(sig);
+ first = false;
+ }
}
return new Sig.TyParamSig(identifier, cbound, ibounds.build());
}
+ private boolean isInterface(Type type, Env<ClassSymbol, TypeBoundClass> env) {
+ return type.tyKind() == TyKind.CLASS_TY
+ && env.get(((ClassTy) type).sym()).kind() == TurbineTyKind.INTERFACE;
+ }
+
public String descriptor(ClassSymbol sym) {
classes.add(sym);
return sym.binaryName();
diff --git a/java/com/google/turbine/type/Type.java b/java/com/google/turbine/type/Type.java
index 018bbdf..e25eca5 100644
--- a/java/com/google/turbine/type/Type.java
+++ b/java/com/google/turbine/type/Type.java
@@ -44,7 +44,9 @@ public interface Type {
/** A type variable type. */
TY_VAR,
/** A wildcard type. */
- WILD_TY
+ WILD_TY,
+ /** An intersection type. */
+ INTERSECTION_TY
}
/** The type kind. */
@@ -100,7 +102,7 @@ public interface Type {
}
@Override
- public String toString() {
+ public final String toString() {
StringBuilder sb = new StringBuilder();
boolean first = true;
for (SimpleClassTy c : classes()) {
@@ -177,7 +179,7 @@ public interface Type {
}
@Override
- public String toString() {
+ public final String toString() {
return sym().owner() + "#" + sym().name();
}
@@ -281,4 +283,20 @@ public interface Type {
throw new IllegalStateException();
}
}
+
+ /** An intersection type. */
+ @AutoValue
+ abstract class IntersectionTy implements Type {
+
+ public abstract ImmutableList<Type> bounds();
+
+ public static IntersectionTy create(ImmutableList<Type> bounds) {
+ return new AutoValue_Type_IntersectionTy(bounds);
+ }
+
+ @Override
+ public TyKind tyKind() {
+ return TyKind.INTERSECTION_TY;
+ }
+ }
}
diff --git a/java/com/google/turbine/types/Canonicalize.java b/java/com/google/turbine/types/Canonicalize.java
index 92553e1..0016011 100644
--- a/java/com/google/turbine/types/Canonicalize.java
+++ b/java/com/google/turbine/types/Canonicalize.java
@@ -30,6 +30,7 @@ import com.google.turbine.type.Type;
import com.google.turbine.type.Type.ArrayTy;
import com.google.turbine.type.Type.ClassTy;
import com.google.turbine.type.Type.ClassTy.SimpleClassTy;
+import com.google.turbine.type.Type.IntersectionTy;
import com.google.turbine.type.Type.TyKind;
import com.google.turbine.type.Type.TyVar;
import com.google.turbine.type.Type.WildTy;
@@ -109,6 +110,8 @@ public class Canonicalize {
}
case CLASS_TY:
return canonicalizeClassTy(base, (ClassTy) type);
+ case INTERSECTION_TY:
+ return canonicalizeIntersectionTy(base, (IntersectionTy) type);
default:
throw new AssertionError(type.tyKind());
}
@@ -370,6 +373,14 @@ public class Canonicalize {
throw new AssertionError(type.boundKind());
}
+ private Type canonicalizeIntersectionTy(ClassSymbol base, IntersectionTy type) {
+ ImmutableList.Builder<Type> bounds = ImmutableList.builder();
+ for (Type bound : type.bounds()) {
+ bounds.add(canonicalize(base, bound));
+ }
+ return IntersectionTy.create(bounds.build());
+ }
+
private TypeBoundClass getInfo(ClassSymbol canonOwner) {
TypeBoundClass info = env.get(canonOwner);
if (info == null) {
diff --git a/java/com/google/turbine/types/Erasure.java b/java/com/google/turbine/types/Erasure.java
index 67aa69a..e2c7d8f 100644
--- a/java/com/google/turbine/types/Erasure.java
+++ b/java/com/google/turbine/types/Erasure.java
@@ -19,11 +19,13 @@ package com.google.turbine.types;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableList;
import com.google.turbine.binder.bound.SourceTypeBoundClass;
+import com.google.turbine.binder.bound.TypeBoundClass.TyVarInfo;
import com.google.turbine.binder.sym.TyVarSymbol;
import com.google.turbine.type.Type;
import com.google.turbine.type.Type.ArrayTy;
import com.google.turbine.type.Type.ClassTy;
import com.google.turbine.type.Type.ClassTy.SimpleClassTy;
+import com.google.turbine.type.Type.IntersectionTy;
import com.google.turbine.type.Type.TyVar;
/** Generic type erasure. */
@@ -39,21 +41,22 @@ public class Erasure {
return eraseArrayTy((Type.ArrayTy) ty, tenv);
case TY_VAR:
return eraseTyVar((TyVar) ty, tenv);
+ case INTERSECTION_TY:
+ return eraseIntersectionTy((Type.IntersectionTy) ty, tenv);
default:
throw new AssertionError(ty.tyKind());
}
}
+ private static Type eraseIntersectionTy(
+ IntersectionTy ty, Function<TyVarSymbol, TyVarInfo> tenv) {
+ return erase(ty.bounds().get(0), tenv);
+ }
+
private static Type eraseTyVar(
TyVar ty, Function<TyVarSymbol, SourceTypeBoundClass.TyVarInfo> tenv) {
SourceTypeBoundClass.TyVarInfo info = tenv.apply(ty.sym());
- if (info.superClassBound() != null) {
- return erase(info.superClassBound(), tenv);
- }
- if (!info.interfaceBounds().isEmpty()) {
- return erase(info.interfaceBounds().get(0), tenv);
- }
- return Type.ClassTy.OBJECT;
+ return erase(info.bound(), tenv);
}
private static Type.ArrayTy eraseArrayTy(
diff --git a/javatests/com/google/turbine/lower/LowerTest.java b/javatests/com/google/turbine/lower/LowerTest.java
index 7ea3d33..ec7d9f9 100644
--- a/javatests/com/google/turbine/lower/LowerTest.java
+++ b/javatests/com/google/turbine/lower/LowerTest.java
@@ -45,6 +45,7 @@ import com.google.turbine.testing.AsmUtils;
import com.google.turbine.type.Type;
import com.google.turbine.type.Type.ClassTy;
import com.google.turbine.type.Type.ClassTy.SimpleClassTy;
+import com.google.turbine.type.Type.IntersectionTy;
import com.google.turbine.type.Type.PrimTy;
import com.google.turbine.type.Type.TyVar;
import java.io.IOException;
@@ -95,13 +96,14 @@ public class LowerTest {
ImmutableMap.of(
new TyVarSymbol(new ClassSymbol("test/Test"), "V"),
new SourceTypeBoundClass.TyVarInfo(
- ClassTy.create(
+ IntersectionTy.create(
ImmutableList.of(
- SimpleClassTy.create(
- new ClassSymbol("test/Test$Inner"),
- ImmutableList.of(),
- ImmutableList.of()))),
- ImmutableList.of(),
+ ClassTy.create(
+ ImmutableList.of(
+ SimpleClassTy.create(
+ new ClassSymbol("test/Test$Inner"),
+ ImmutableList.of(),
+ ImmutableList.of()))))),
ImmutableList.of()));
int access = TurbineFlag.ACC_SUPER | TurbineFlag.ACC_PUBLIC;
ImmutableList<SourceTypeBoundClass.MethodInfo> methods =
@@ -122,24 +124,25 @@ public class LowerTest {
ImmutableMap.of(
new TyVarSymbol(new MethodSymbol(new ClassSymbol("test/Test"), "g"), "V"),
new SourceTypeBoundClass.TyVarInfo(
- null,
- ImmutableList.of(
- ClassTy.create(
- ImmutableList.of(
- SimpleClassTy.create(
- new ClassSymbol("java/lang/Runnable"),
- ImmutableList.of(),
- ImmutableList.of())))),
+ IntersectionTy.create(
+ ImmutableList.of(
+ ClassTy.create(
+ ImmutableList.of(
+ SimpleClassTy.create(
+ new ClassSymbol("java/lang/Runnable"),
+ ImmutableList.of(),
+ ImmutableList.of()))))),
ImmutableList.of()),
new TyVarSymbol(new MethodSymbol(new ClassSymbol("test/Test"), "g"), "E"),
new SourceTypeBoundClass.TyVarInfo(
- ClassTy.create(
+ IntersectionTy.create(
ImmutableList.of(
- SimpleClassTy.create(
- new ClassSymbol("java/lang/Error"),
- ImmutableList.of(),
- ImmutableList.of()))),
- ImmutableList.of(),
+ ClassTy.create(
+ ImmutableList.of(
+ SimpleClassTy.create(
+ new ClassSymbol("java/lang/Error"),
+ ImmutableList.of(),
+ ImmutableList.of()))))),
ImmutableList.of())),
Type.VOID,
ImmutableList.of(