-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Refine implicit priority change warnings #21045
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c9b9ad4
Refine implicit priority change warnings
odersky 59a0f36
Fix -source for neg test
odersky 668daf1
Filter out more false positives in priority change warnings
odersky 4bc7c10
Fix -source for neg test (2)
odersky 1474e69
Fix priority change logic for ranking
odersky 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,4 @@ | ||
-- [E172] Type Error: tests/neg/given-triangle.scala:15:18 ------------------------------------------------------------- | ||
15 |@main def Test = f // error | ||
| ^ | ||
|Ambiguous given instances: both given instance given_B and given instance given_C match type A of parameter a of method f |
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
File renamed without changes.
File renamed without changes.
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,7 @@ | ||
//> using options -Werror | ||
trait Writes[T] | ||
trait Format[T] extends Writes[T] | ||
given [T: List]: Writes[T] = null | ||
given [T]: Format[T] = null | ||
|
||
val _ = summon[Writes[Int]] |
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,16 @@ | ||
//> using options -source 3.5 -Werror | ||
trait SameRuntime[A, B] | ||
trait BSONWriter[T] | ||
trait BSONHandler[T] extends BSONWriter[T] | ||
|
||
opaque type Id = String | ||
object Id: | ||
given SameRuntime[Id, String] = ??? | ||
|
||
given BSONHandler[String] = ??? | ||
given [T: BSONHandler]: BSONHandler[List[T]] = ??? | ||
|
||
given opaqueWriter[T, A](using rs: SameRuntime[T, A], writer: BSONWriter[A]): BSONWriter[T] = ??? | ||
|
||
val x = summon[BSONHandler[List[Id]]] // this doesn't emit warning | ||
val y = summon[BSONWriter[List[Id]]] // this did emit warning |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import language.future | ||
import language.`3.6` | ||
|
||
class A | ||
class B extends A | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,6 @@ | ||
-- Warning: tests/warn/i21036a.scala:7:17 ------------------------------------------------------------------------------ | ||
7 |val y = summon[A] // warn | ||
| ^ | ||
| Given search preference for A between alternatives (b : B) and (a : A) will change | ||
| Current choice : the first alternative | ||
| New choice from Scala 3.6: the second alternative |
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,7 @@ | ||
//> using options -source 3.5 | ||
trait A | ||
trait B extends A | ||
given b: B = ??? | ||
given a: A = ??? | ||
|
||
val y = summon[A] // warn |
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,6 @@ | ||
-- Warning: tests/warn/i21036b.scala:7:17 ------------------------------------------------------------------------------ | ||
7 |val y = summon[A] // warn | ||
| ^ | ||
| Change in given search preference for A between alternatives (b : B) and (a : A) | ||
| Previous choice : the first alternative | ||
| New choice from Scala 3.6: the second alternative |
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,7 @@ | ||
//> using options -source 3.6-migration | ||
trait A | ||
trait B extends A | ||
given b: B = ??? | ||
given a: A = ??? | ||
|
||
val y = summon[A] // warn |
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.
I suppose
sv
is constant andisWarnPriorityChangeVersion
could then be a valThere 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.
No, I use it below as well in the assert that we originally commented out.
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.
Oh, I meant even
isWarnPriorityChangeVersion(Feature.sourceVersion)
would be constant between calls ofcompareAlternatives
. But no big deal either way, this is still ready to merge for meThere 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.
Yes, but be need sourceVersion as
sv
separately in compareAlternatives.