-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport "Fix failing bounds check on default getter" to LTS (#20658)
Backports #18419 to the LTS branch. PR submitted by the release tooling. [skip ci]
- Loading branch information
Showing
3 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import compiletime.ops.int.Max | ||
|
||
trait DFSInt[W <: Int] | ||
trait Candidate[R]: | ||
type OutW <: Int | ||
object Candidate: | ||
given [W <: Int, R <: DFSInt[W]]: Candidate[R] with | ||
type OutW = W | ||
|
||
def foo[R](rhs: R)(using icR: Candidate[R]): DFSInt[Max[8, icR.OutW]] = ??? | ||
|
||
object Test: | ||
def check[A](a: A, clue: Int = 1): Unit = ??? | ||
val x: DFSInt[8] = ??? | ||
check(foo(x)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import scala.compiletime.ops.int.Max | ||
|
||
trait Foo[A] | ||
trait Bar[B]: | ||
type Out <: Int | ||
object Bar: | ||
given inst[C <: Int]: Bar[C] with | ||
type Out = C | ||
|
||
class Test: | ||
def mkFoo(using bx: Bar[2]): Foo[Max[1, bx.Out]] = ??? | ||
def check[Y](yy: Y, clue: Int = 1): Unit = () | ||
|
||
def test: Unit = check(mkFoo) |