Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions compiler/src/dotty/tools/dotc/core/TypeComparer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2912,6 +2912,8 @@ class TrackingTypeComparer(initctx: Context) extends TypeComparer(initctx) {
case cas: HKTypeLambda =>
caseLambda = constrained(cas)
caseLambda.resultType
case _: Range =>
return Some(NoType)
case _ =>
cas
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5989,7 +5989,7 @@ object Types {
/** A range of possible types between lower bound `lo` and upper bound `hi`.
* Only used internally in `ApproximatingTypeMap`.
*/
private case class Range(lo: Type, hi: Type) extends UncachedGroundType {
private[core] case class Range(lo: Type, hi: Type) extends UncachedGroundType {
assert(!lo.isInstanceOf[Range])
assert(!hi.isInstanceOf[Range])

Expand Down
17 changes: 17 additions & 0 deletions tests/neg/i15362.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import scala.compiletime.*
import scala.compiletime.ops.int.*

abstract sealed class HList :
def ::[H](head: H): HNonEmpty[H, this.type] = HNonEmpty(head, this)

case object HNil extends HList
case class HNonEmpty[H, T <: HList](head: H, tail: T) extends HList :
type Elem[N <: Int] =
N match
case 0 => H
case S[n1] => Elem[n1]

inline def apply[N <: Int](n: N): Elem[N] =
n match
case _: 0 => head
case _: S[n1] => tail.asInstanceOf[HNonEmpty[?, ?]].apply(constValue[n1]) // error