File tree 2 files changed +19
-2
lines changed
compiler/src/dotty/tools/dotc/typer
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
1872
1872
arg match {
1873
1873
case untpd.WildcardTypeBoundsTree ()
1874
1874
if tparam.paramInfo.isLambdaSub &&
1875
- tpt1.tpe.typeParamSymbols.nonEmpty &&
1876
- ! ctx.mode.is(Mode .Pattern ) =>
1875
+ tpt1.tpe.typeParamSymbols.nonEmpty =>
1877
1876
// An unbounded `_` automatically adapts to type parameter bounds. This means:
1878
1877
// If we have wildcard application C[?], where `C` is a class replace
1879
1878
// 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