diff options
author | schinz <schinz@epfl.ch> | 2005-04-07 19:47:48 +0000 |
---|---|---|
committer | schinz <schinz@epfl.ch> | 2005-04-07 19:47:48 +0000 |
commit | fd4e74823ef61bdd8cd8eaffff03e62f6becd087 (patch) | |
tree | c87b023437e6dca950fed8e9409ae47c69df072d | |
parent | 36d0dca50b187ded0a9c12e8ddd7d9332882f44f (diff) | |
download | scala-fd4e74823ef61bdd8cd8eaffff03e62f6becd087.tar.gz scala-fd4e74823ef61bdd8cd8eaffff03e62f6becd087.tar.bz2 scala-fd4e74823ef61bdd8cd8eaffff03e62f6becd087.zip |
- accept the creation of compound types with no...
- accept the creation of compound types with non-empty refinements, but
fail as soon as isSameType/isSubType is attempted
-rw-r--r-- | sources/scala/runtime/types/CompoundType.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sources/scala/runtime/types/CompoundType.java b/sources/scala/runtime/types/CompoundType.java index 662d46cfa5..18b8f8deb6 100644 --- a/sources/scala/runtime/types/CompoundType.java +++ b/sources/scala/runtime/types/CompoundType.java @@ -24,13 +24,11 @@ import scala.runtime.RunTime; public class CompoundType extends Type { public final ClassType[] components; + public final boolean emptyRefinement; public CompoundType(ClassType[] components, boolean emptyRefinement) { this.components = components; - - if (!emptyRefinement) - throw new Error("attempt to build a compound type with " - + "non-empty refinement"); + this.emptyRefinement = emptyRefinement; } public Array newArray(int size) { @@ -52,8 +50,12 @@ public class CompoundType extends Type { } public boolean isSubType(Type that) { + if (!emptyRefinement) + throw new Error("cannot compute isSubType (non-empty refinement)"); + if (that instanceof CompoundType) { - ClassType[] thatComponents = ((CompoundType)that).components; + CompoundType thatCT = (CompoundType)that; + ClassType[] thatComponents = thatCT.components; for (int i = 0; i < thatComponents.length; ++i) { if (!this.isSubType(thatComponents[i])) return false; @@ -69,6 +71,9 @@ public class CompoundType extends Type { } public boolean isSameType(Type that) { + if (!emptyRefinement) + throw new Error("cannot compute isSameType (non-empty refinement)"); + if (that instanceof CompoundType) { CompoundType thatCT = (CompoundType)that; |