-
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.
refactor: improve Given search preference warning
**Problem** It wasn't clear what action users was suppose to take to suppress the new-from-3.6 Given search preference warning. **Solution** 1. This refactors the code to give the warning an error code E205. 2. In case of warnings, tell the user to choose -source 3.5 vs 3.7, or use nowarn annotation.
- Loading branch information
Showing
7 changed files
with
66 additions
and
28 deletions.
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
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
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,10 +1,13 @@ | ||
-- Warning: tests/warn/i21036a.scala:7:17 ------------------------------------------------------------------------------ | ||
-- [E205] Potential Issue 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.7: the second alternative | ||
| will change in the future release. | ||
| Current choice : the first alternative | ||
| Choice from Scala 3.7 : the second alternative | ||
| | ||
| Suppress this warning by choosing -source 3.5, -source 3.7, or | ||
| by using @annotation.nowarn("id=205") |
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,10 +1,13 @@ | ||
-- Warning: tests/warn/i21036b.scala:7:17 ------------------------------------------------------------------------------ | ||
-- [E205] Potential Issue Warning: tests/warn/i21036b.scala:7:17 ------------------------------------------------------- | ||
7 |val y = summon[A] // warn | ||
| ^ | ||
| Given search preference for A between alternatives | ||
| (b : B) | ||
| and | ||
| (a : A) | ||
| has changed. | ||
| Previous choice : the first alternative | ||
| New choice from Scala 3.7: the second alternative | ||
| Previous choice : the first alternative | ||
| Choice from Scala 3.7 : the second alternative | ||
| | ||
| Suppress this warning by choosing -source 3.5, -source 3.7, or | ||
| by using @annotation.nowarn("id=205") |
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 @@ | ||
trait A | ||
trait B extends A | ||
given b: B = ??? | ||
given a: A = ??? | ||
|
||
@annotation.nowarn("id=205") | ||
val y = summon[A] // don't warn |