forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shorten traces for TypeMismatch errors under -explain (scala#18742)
This is a partial fix for scala#18737. We still can't explain the differences concisely, but at least we shorten the comparison traces by showing only steps that contributed to the overall failure and by avoiding repetitions.
- Loading branch information
Showing
7 changed files
with
130 additions
and
53 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,75 @@ | ||
-- [E007] Type Mismatch Error: tests/neg/i18737.scala:3:36 ------------------------------------------------------------- | ||
3 |def test2(v: String & Long) = test1(v) // error | ||
| ^ | ||
| Found: (v : String & Long) | ||
| Required: String & Integer & List[String] | ||
|--------------------------------------------------------------------------------------------------------------------- | ||
| Explanation (enabled by `-explain`) | ||
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
| | ||
| Tree: v | ||
| I tried to show that | ||
| (v : String & Long) | ||
| conforms to | ||
| String & Integer & List[String] | ||
| but none of the attempts shown below succeeded: | ||
| | ||
| ==> (v : String & Long) <: String & Integer & List[String] | ||
| ==> (v : String & Long) <: String & Integer | ||
| ==> (v : String & Long) <: Integer | ||
| ==> String & Long <: Integer | ||
| ==> String <: Integer = false | ||
| ==> Long <: Integer = false | ||
| | ||
| The tests were made under the empty constraint | ||
--------------------------------------------------------------------------------------------------------------------- | ||
-- [E007] Type Mismatch Error: tests/neg/i18737.scala:6:36 ------------------------------------------------------------- | ||
6 |def test4(v: String | Long) = test3(v) // error | ||
| ^ | ||
| Found: (v : String | Long) | ||
| Required: String | Integer | List[String] | ||
|--------------------------------------------------------------------------------------------------------------------- | ||
| Explanation (enabled by `-explain`) | ||
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
| | ||
| Tree: v | ||
| I tried to show that | ||
| (v : String | Long) | ||
| conforms to | ||
| String | Integer | List[String] | ||
| but none of the attempts shown below succeeded: | ||
| | ||
| ==> (v : String | Long) <: String | Integer | List[String] | ||
| ==> String | Long <: String | Integer | List[String] | ||
| ==> Long <: String | Integer | List[String] | ||
| ==> Long <: String | Integer | ||
| ==> Long <: String = false | ||
| ==> Long <: Integer = false | ||
| ==> Long <: List[String] = false | ||
| ==> (v : String | Long) <: String | Integer | ||
| ==> String | Long <: String | Integer | ||
| ==> Long <: String | Integer | ||
| ==> Long <: String = false | ||
| ==> Long <: Integer = false | ||
| ==> (v : String | Long) <: String | ||
| ==> String | Long <: String | ||
| ==> Long <: String = false | ||
| ==> (v : String | Long) <: Integer | ||
| ==> String | Long <: Integer | ||
| ==> String <: Integer = false | ||
| ==> String | Long <: String | Integer | ||
| ==> Long <: String | Integer | ||
| ==> Long <: String = false | ||
| ==> Long <: Integer = false | ||
| ==> (v : String | Long) <: List[String] | ||
| ==> String | Long <: List[String] | ||
| ==> String <: List[String] = false | ||
| ==> String | Long <: String | Integer | List[String] | ||
| ==> Long <: String | Integer | List[String] | ||
| ==> Long <: String | Integer | ||
| ==> Long <: String = false | ||
| ==> Long <: Integer = false | ||
| ==> Long <: List[String] = false | ||
| | ||
| The tests were made under the empty constraint | ||
--------------------------------------------------------------------------------------------------------------------- |
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 @@ | ||
//> using options -explain | ||
def test1(v: String & Integer & List[String]) = () | ||
def test2(v: String & Long) = test1(v) // error | ||
|
||
def test3(v: String | Integer | List[String]) = () | ||
def test4(v: String | Long) = test3(v) // error |