Skip to content

Commit 19b6a04

Browse files
committed
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.
1 parent 058729c commit 19b6a04

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
735735
def typedAppliedTypeTree(tree: untpd.AppliedTypeTree)(implicit ctx: Context): AppliedTypeTree = track("typedAppliedTypeTree") {
736736
val tpt1 = typed(tree.tpt)
737737
val args1 = tree.args mapconserve (typed(_))
738-
// todo in later phase: check arguments conform to parameter bounds
738+
// check that arguments conform to bounds is done in phase FirstTransform
739739
assignType(cpy.AppliedTypeTree(tree, tpt1, args1), tpt1, args1)
740740
}
741741

@@ -748,9 +748,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
748748
val TypeBoundsTree(lo, hi) = desugar.typeBoundsTree(tree)
749749
val lo1 = typed(lo)
750750
val hi1 = typed(hi)
751-
// need to do in later phase, as this might cause a cyclic reference error. See pos/t0039.scala
752-
// if (!(lo1.tpe <:< hi1.tpe))
753-
// ctx.error(d"lower bound ${lo1.tpe} does not conform to upper bound ${hi1.tpe}", tree.pos)
751+
if (!(lo1.tpe <:< hi1.tpe))
752+
ctx.error(d"lower bound ${lo1.tpe} does not conform to upper bound ${hi1.tpe}", tree.pos)
754753
assignType(cpy.TypeBoundsTree(tree, lo1, hi1), lo1, hi1)
755754
}
756755

test/dotc/tests.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ class tests extends CompilerTest {
8484
@Test def neg_tailcall = compileFile(negDir, "tailcall/tailrec", xerrors = 7)
8585
@Test def neg_tailcall2 = compileFile(negDir, "tailcall/tailrec-2", xerrors = 2)
8686
@Test def neg_tailcall3 = compileFile(negDir, "tailcall/tailrec-3", xerrors = 2)
87+
@Test def nef_t1279a = compileFile(negDir, "t1279a", xerrors = 1)
8788
@Test def neg_t1843 = compileFile(negDir, "t1843", xerrors = 1)
8889
@Test def neg_t1843_variances = compileFile(negDir, "t1843-variances", xerrors = 1)
8990
@Test def neg_t2994 = compileFile(negDir, "t2994", xerrors = 2)

tests/pos/t1279a.scala renamed to tests/neg/t1279a.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// covariant linked list
22
abstract class M {
3-
self =>
3+
self: M =>
44

55
type T
66
final type selfType = M {type T <: self.T}
7-
type actualSelfType >: self.type <: selfType
7+
type actualSelfType >: self.type <: selfType // this no longer compiles because self.type is not a subtype of selfType
88

99
def next: selfType
1010

0 commit comments

Comments
 (0)