Skip to content

Commit 990eff8

Browse files
committed
Drop test that lower bound must be a subtype of upper bound.
As discussed in #780 and #525, the test is not needed. This makes t1279a compile, which got moved now to pos. Fixes #780 and #915. It also makes scala.List compile. Review by @smarter.
1 parent c16c7f6 commit 990eff8

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -864,8 +864,6 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
864864
val TypeBoundsTree(lo, hi) = desugar.typeBoundsTree(tree)
865865
val lo1 = typed(lo)
866866
val hi1 = typed(hi)
867-
if (!(lo1.tpe <:< hi1.tpe))
868-
ctx.error(d"lower bound ${lo1.tpe} does not conform to upper bound ${hi1.tpe}", tree.pos)
869867
assignType(cpy.TypeBoundsTree(tree)(lo1, hi1), lo1, hi1)
870868
}
871869

test/dotc/scala-collections.whitelist

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@
112112
./scala-scala/src/library/scala/collection/immutable/Iterable.scala
113113
./scala-scala/src/library/scala/collection/immutable/LinearSeq.scala
114114

115-
# https://github.com/lampepfl/dotty/issues/915
116-
# ./scala-scala/src/library/scala/collection/immutable/List.scala
115+
./scala-scala/src/library/scala/collection/immutable/List.scala
117116
./scala-scala/src/library/scala/collection/immutable/MapProxy.scala
118117
./scala-scala/src/library/scala/collection/immutable/PagedSeq.scala
119118
./scala-scala/src/library/scala/collection/immutable/Queue.scala

tests/pos/bounds.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,10 @@ object ListMap {
99
def empty[X, Y] = new ListMap[X, Y]
1010
def apply[A1, B2](elems: Tuple2[A1, B2]*): Map[A1, B2] = empty[A1,B2].++(elems.iterator)
1111
}
12+
13+
class Test[A] {
14+
15+
def f[B >: A <: AnyRef](x: A): AnyRef = (x: B)
16+
def g[B >: String <: Int](x: B): Int = x
17+
18+
}
File renamed without changes.

0 commit comments

Comments
 (0)