-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix failing bounds check on default getter #18419
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this type of confusion occur somewhere else in code, but we just didn't notice it yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the question. By code, do you mean compiler code, or do you mean something about user's code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I wasn't clear. I meant in compiler code where we have something like
.appliedToTypes(targs.tpes)
and actually needs to be constructed with span.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that I'm aware of. Looking now, perhaps the
.appliedToTypes(patternTypes)
in quotes pattern should reuse the original pattern tree spans, but I'm not certain. I was thinking Martin would be able to tell if this is a reoccurring problem and how to best deal with it.