diff options
author | Hubert Plociniczak <hubert.plociniczak@gmail.com> | 2012-12-12 00:15:48 +0100 |
---|---|---|
committer | Hubert Plociniczak <hubert.plociniczak@gmail.com> | 2012-12-12 22:10:00 +0100 |
commit | 24455e22d56c8447fdf6089ad612f6ce75020f0b (patch) | |
tree | 5e6451fff2905d9ced0abd061b967d0326ccc7b1 /test/files/pos | |
parent | 7fe7d2537963dd24ea1cca7b0c4b96f96b773c4a (diff) | |
download | scala-24455e22d56c8447fdf6089ad612f6ce75020f0b.tar.gz scala-24455e22d56c8447fdf6089ad612f6ce75020f0b.tar.bz2 scala-24455e22d56c8447fdf6089ad612f6ce75020f0b.zip |
Recurse into instantiations when stripping type vars.
This led to the inference of weird types as list
of lub base types was empty.
This change fixes case x3 in the test case.
Diffstat (limited to 'test/files/pos')
-rw-r--r-- | test/files/pos/strip-tvars-for-lubbasetypes.scala | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/files/pos/strip-tvars-for-lubbasetypes.scala b/test/files/pos/strip-tvars-for-lubbasetypes.scala new file mode 100644 index 0000000000..2be8625bae --- /dev/null +++ b/test/files/pos/strip-tvars-for-lubbasetypes.scala @@ -0,0 +1,25 @@ +object Test { + + implicit final class EqualOps[T](val x: T) extends AnyVal { + def ===[T1, Ph >: T <: T1, Ph2 >: Ph <: T1](other: T1): Boolean = x == other + def !!![T1, Ph2 >: Ph <: T1, Ph >: T <: T1](other: T1): Boolean = x == other + } + + class A + class B extends A + class C extends A + + val a = new A + val b = new B + val c = new C + + val x1 = a === b + val x2 = b === a + val x3 = b === c // error, infers Object{} for T1 + val x4 = b.===[A, B, B](c) + + val x5 = b !!! c // always compiled due to the order of Ph2 and Ph + + + +} |