diff options
author | Martin Odersky <odersky@gmail.com> | 2014-11-21 14:45:01 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-11-24 14:57:49 +0100 |
commit | 7427c671f9a5321dd13a74b5175bba512699b385 (patch) | |
tree | 037dbd3394a259592edc6a9bc264b09ddb31b01c /test | |
parent | a89f48d1c3bef21ecf14048985334de6e0a8e505 (diff) | |
download | dotty-7427c671f9a5321dd13a74b5175bba512699b385.tar.gz dotty-7427c671f9a5321dd13a74b5175bba512699b385.tar.bz2 dotty-7427c671f9a5321dd13a74b5175bba512699b385.zip |
Fixes in TypeComparer for RefinedTypes.
The previous scheme did not propagate bounds correctly. More generally,
given a comparison
T { X <: A } <: U { X <: B }
it would errenously decompose this to
T <: U, A <: B
But we really need to check whether the total constraint for X in T { X <: A }
subsumes the total constraint for X in T { X <: B }
The new scheme propagates only if the binding in the lower type is an alias.
E.g.
T { X = A } <: Y { X <: B }
decomposes to
T { A = A } <: U, A <: B
The change uncovered another bug, where in the slow path we too a member relative to a refined type;
We need to "narrow" the type to a RefinedThis instead. (See use of "narrow" in TypeComparer).
That change uncovered a third bug concerning the underlying type of a RefinedThis. The last bug was fixed in a previous commit (84f32cd814f2e07725b6ad1f6bff23d4ee38c397).
Two tests (1048, 1843) which were pos tests for scalac but failed compling in dotc have
changed their status and location. They typecheck now, but fail later. They have been
moved to pending.
There's a lot of diagnostic code in TypeComparer to figure out the various problems. I left it in
to be able to come back to the commit in case there are more problems. The checks and diagnostics
will be removed in a subsequent commit.
Diffstat (limited to 'test')
-rw-r--r-- | test/dotc/tests.scala | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala index 4b7d124d0..4999e5e4b 100644 --- a/test/dotc/tests.scala +++ b/test/dotc/tests.scala @@ -95,9 +95,7 @@ class tests extends CompilerTest { @Test def neg_tailcall = compileFile(negDir, "tailcall/tailrec", xerrors = 7) @Test def neg_tailcall2 = compileFile(negDir, "tailcall/tailrec-2", xerrors = 2) @Test def neg_tailcall3 = compileFile(negDir, "tailcall/tailrec-3", xerrors = 2) - @Test def neg_t1048 = compileFile(negDir, "t1048", xerrors = 1) @Test def nef_t1279a = compileFile(negDir, "t1279a", xerrors = 1) - @Test def neg_t1843 = compileFile(negDir, "t1843", xerrors = 1) @Test def neg_t1843_variances = compileFile(negDir, "t1843-variances", xerrors = 1) @Test def neg_t2660_ambi = compileFile(negDir, "t2660", xerrors = 2) @Test def neg_t2994 = compileFile(negDir, "t2994", xerrors = 2) @@ -107,6 +105,7 @@ class tests extends CompilerTest { @Test def neg_typetest = compileFile(negDir, "typetest", xerrors = 1) @Test def neg_t1569_failedAvoid = compileFile(negDir, "t1569-failedAvoid", xerrors = 1) @Test def neg_cycles = compileFile(negDir, "cycles", xerrors = 6) + @Test def neg_boundspropagation = compileFile(negDir, "boundspropagation", xerrors = 3) @Test def dotc = compileDir(dotcDir + "tools/dotc", twice)(allowDeepSubtypes) @Test def dotc_ast = compileDir(dotcDir + "tools/dotc/ast", twice) |