-
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.
Add note about type mismatch in automatically inserted apply argument
Co-Authored-By: Jan-Pieter van den Heuvel <[email protected]> Co-Authored-By: Lucas Nouguier <[email protected]>
- Loading branch information
1 parent
912d886
commit 2c70f3d
Showing
9 changed files
with
103 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,24 @@ | ||
-- [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`, | ||
| which is the type of `augmentString(renderWebsite("/tmp")(x$1))`. | ||
--------------------------------------------------------------------------------------------------------------------- |
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,25 @@ | ||
-- [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]`, | ||
| which is the type of `List.apply[Int]([1,2 : 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 |