diff options
author | Martin Odersky <odersky@gmail.com> | 2014-08-08 21:37:49 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-08-08 21:38:17 +0200 |
commit | 19b6a04486a4f9a2a7803d40d7ef6199cdeaf31c (patch) | |
tree | a55e634795d79d084310d5aa533751d91dfc78fb | |
parent | 058729ceac3354a2cc34490b528e76afb09ee0ce (diff) | |
download | dotty-19b6a04486a4f9a2a7803d40d7ef6199cdeaf31c.tar.gz dotty-19b6a04486a4f9a2a7803d40d7ef6199cdeaf31c.tar.bz2 dotty-19b6a04486a4f9a2a7803d40d7ef6199cdeaf31c.zip |
Re-enabled checkbounds tests
Now that F-bunded types are treated more robustly, we can check bounds for
non-emptyness during Typer.
This unvealed one wrong test (wonder how that passed scalac?), which got
moved to neg.
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 7 | ||||
-rw-r--r-- | test/dotc/tests.scala | 1 | ||||
-rw-r--r-- | tests/neg/t1279a.scala (renamed from tests/pos/t1279a.scala) | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index d5153bf13..2024a993e 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -735,7 +735,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit def typedAppliedTypeTree(tree: untpd.AppliedTypeTree)(implicit ctx: Context): AppliedTypeTree = track("typedAppliedTypeTree") { val tpt1 = typed(tree.tpt) val args1 = tree.args mapconserve (typed(_)) - // todo in later phase: check arguments conform to parameter bounds + // check that arguments conform to bounds is done in phase FirstTransform assignType(cpy.AppliedTypeTree(tree, tpt1, args1), tpt1, args1) } @@ -748,9 +748,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit val TypeBoundsTree(lo, hi) = desugar.typeBoundsTree(tree) val lo1 = typed(lo) val hi1 = typed(hi) - // need to do in later phase, as this might cause a cyclic reference error. See pos/t0039.scala - // if (!(lo1.tpe <:< hi1.tpe)) - // ctx.error(d"lower bound ${lo1.tpe} does not conform to upper bound ${hi1.tpe}", tree.pos) + if (!(lo1.tpe <:< hi1.tpe)) + ctx.error(d"lower bound ${lo1.tpe} does not conform to upper bound ${hi1.tpe}", tree.pos) assignType(cpy.TypeBoundsTree(tree, lo1, hi1), lo1, hi1) } diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala index fa577573a..8bbe30ad8 100644 --- a/test/dotc/tests.scala +++ b/test/dotc/tests.scala @@ -84,6 +84,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 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_t2994 = compileFile(negDir, "t2994", xerrors = 2) diff --git a/tests/pos/t1279a.scala b/tests/neg/t1279a.scala index 18b1e53f4..6d768d435 100644 --- a/tests/pos/t1279a.scala +++ b/tests/neg/t1279a.scala @@ -1,10 +1,10 @@ // covariant linked list abstract class M { - self => + self: M => type T final type selfType = M {type T <: self.T} - type actualSelfType >: self.type <: selfType + type actualSelfType >: self.type <: selfType // this no longer compiles because self.type is not a subtype of selfType def next: selfType |