diff options
author | Martin Odersky <odersky@gmail.com> | 2014-11-26 11:46:46 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-11-26 11:46:52 +0100 |
commit | fc319b002ff4bc82061250352f1568c612c70d72 (patch) | |
tree | f2f8a76eb5e8dd8926a35271118cf0e3b91182f5 /test | |
parent | 5733684a4ec6857ece1048d56654dcd749163510 (diff) | |
download | dotty-fc319b002ff4bc82061250352f1568c612c70d72.tar.gz dotty-fc319b002ff4bc82061250352f1568c612c70d72.tar.bz2 dotty-fc319b002ff4bc82061250352f1568c612c70d72.zip |
Allow refinements that refine already refined types.
Previously, a double definition errorfor `T` was produced in a case like this:
type T1 = C { T <: A }
type T2 = T1 { T <: B }
This was caused by the way T1 was treated in the refinement class
that is used to typecheck the type. Desugaring of T2 with `refinedTypeToClass`
would give
trait <refinement> extends T1 { type T <: B }
and `normalizeToClassRefs` would transform this to:
trait <refinement> extends C { type T <: A; type T <: B }
Hence the double definition. The new scheme desugars the rhs of `T2` to:
trait <refinement> extends C { this: T1 => type T <: B }
which avoids the problem.
Also, added tests that #232 (fix/boundsPropagation) indeed considers all refinements
together when comparing refined types.
Diffstat (limited to 'test')
-rw-r--r-- | test/dotc/tests.scala | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala index 1c437e833..d592aaa24 100644 --- a/test/dotc/tests.scala +++ b/test/dotc/tests.scala @@ -106,6 +106,7 @@ class tests extends CompilerTest { @Test def neg_t1569_failedAvoid = compileFile(negDir, "t1569-failedAvoid", xerrors = 1) @Test def neg_cycles = compileFile(negDir, "cycles", xerrors = 8) @Test def neg_boundspropagation = compileFile(negDir, "boundspropagation", xerrors = 4) + @Test def neg_refinedSubtyping = compileFile(negDir, "refinedSubtyping", xerrors = 2) @Test def dotc = compileDir(dotcDir + "tools/dotc", twice)(allowDeepSubtypes) @Test def dotc_ast = compileDir(dotcDir + "tools/dotc/ast", twice) |