-
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 "Add note about type mismatch in automatically inserted appl…
…y argument" to LTS (#21090) Backports #20023 to the LTS branch. PR submitted by the release tooling. [skip ci]
- Loading branch information
Showing
9 changed files
with
102 additions
and
4 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
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,23 @@ | ||
-- [E007] Type Mismatch Error: tests/neg/19680.scala:9:67 -------------------------------------------------------------- | ||
9 |def renderWidget(using Config): Unit = renderWebsite("/tmp")(Config()) // error: found Config, required Int | ||
| ^^^^^^^^ | ||
| Found: Config | ||
| Required: Int | ||
|--------------------------------------------------------------------------------------------------------------------- | ||
| Explanation (enabled by `-explain`) | ||
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
| | ||
| Tree: new Config() | ||
| I tried to show that | ||
| Config | ||
| conforms to | ||
| Int | ||
| but none of the attempts shown below succeeded: | ||
| | ||
| ==> Config <: Int = false | ||
| | ||
| The tests were made under the empty constraint | ||
| | ||
| The required type comes from a parameter of the automatically | ||
| inserted `apply` method of `scala.collection.StringOps`. | ||
--------------------------------------------------------------------------------------------------------------------- |
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,9 @@ | ||
//> using options -explain | ||
|
||
// Tests that the error message indicates that the required type `Int` comes | ||
// from the automatically inserted `apply` method of `String`. This note is | ||
// inserted by `insertedApplyNote` in `Applications`. | ||
|
||
class Config() | ||
def renderWebsite(path: String)(using config: Config): String = ??? | ||
def renderWidget(using Config): Unit = renderWebsite("/tmp")(Config()) // error: found Config, required 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,24 @@ | ||
-- [E007] Type Mismatch Error: tests/neg/19680b.scala:2:21 ------------------------------------------------------------- | ||
2 |def Test = List(1,2)("hello") // error: found String, required Int | ||
| ^^^^^^^ | ||
| Found: ("hello" : String) | ||
| Required: Int | ||
|--------------------------------------------------------------------------------------------------------------------- | ||
| Explanation (enabled by `-explain`) | ||
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
| | ||
| Tree: "hello" | ||
| I tried to show that | ||
| ("hello" : String) | ||
| conforms to | ||
| Int | ||
| but none of the attempts shown below succeeded: | ||
| | ||
| ==> ("hello" : String) <: Int | ||
| ==> String <: Int = false | ||
| | ||
| The tests were made under the empty constraint | ||
| | ||
| The required type comes from a parameter of the automatically | ||
| inserted `apply` method of `List[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,2 @@ | ||
//> using options -explain | ||
def Test = List(1,2)("hello") // error: found String, required Int |