File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -1872,8 +1872,7 @@ class Typer extends Namer
18721872 arg match {
18731873 case untpd.WildcardTypeBoundsTree ()
18741874 if tparam.paramInfo.isLambdaSub &&
1875- tpt1.tpe.typeParamSymbols.nonEmpty &&
1876- ! ctx.mode.is(Mode .Pattern ) =>
1875+ tpt1.tpe.typeParamSymbols.nonEmpty =>
18771876 // An unbounded `_` automatically adapts to type parameter bounds. This means:
18781877 // If we have wildcard application C[?], where `C` is a class replace
18791878 // with C[? >: L <: H] where `L` and `H` are the bounds of the corresponding
Original file line number Diff line number Diff line change 1+ import scala .compiletime .ops .int .S
2+
3+ sealed trait TList
4+ sealed trait TNil extends TList
5+ sealed trait ++: [H [_], T <: TList ] extends TList
6+
7+ type IndexOf [H [_], T <: TList ] <: Int = T match
8+ case H ++: _ => 0
9+ case _ ++: t => S [IndexOf [H , t]]
10+
11+ // compiles fine
12+ val a = summon[ValueOf [IndexOf [List , List ++: Option ++: TNil ]]].value
13+
14+ // causes an error
15+ val b = summon[ValueOf [IndexOf [List , Option ++: List ++: TNil ]]].value
16+
17+ object T extends App :
18+ println(a)
You can’t perform that action at this time.
0 commit comments