File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ package repro
2+ object repro :
3+ object opq :
4+ opaque type Lift [T ] = Int
5+ extension(v : Int )
6+ def lift [T ]: Lift [T ] = v
7+ extension[T ](l : Lift [T ])
8+ def value : Int = l
9+
10+ export opq .Lift as Lift
11+ export opq .lift as lift
12+
13+ final type Two
14+
15+ extension[TL ](l : Lift [TL ])
16+ def repro [TR ](using m : Mul [TL , TR ]): Int = l.value + m.value
17+
18+ abstract class Mul [TL , TR ]:
19+ val value : Int
20+
21+ transparent inline given mulGivenInt [TL <: Int & Singleton , TR <: Int & Singleton ]: Mul [TL , TR ] =
22+ val m : Int = scala.compiletime.constValue[TL ] * scala.compiletime.constValue[TR ]
23+ new Mul [TL , TR ] { val value : Int = m }
24+
25+ transparent inline given mulGivenTwo [TR <: Int & Singleton ]: Mul [Two , TR ] =
26+ val m : Int = 2 * scala.compiletime.constValue[TR ]
27+ new Mul [Two , TR ] { val value : Int = m }
Original file line number Diff line number Diff line change 1+ import repro .repro .{* , given }
2+
3+ val x = 1 .lift[Two ]
4+ val _ = x.repro[2 ]
5+ val y = 1 .lift[2 ]
6+ val _ = y.repro[2 ]
You can’t perform that action at this time.
0 commit comments