-
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.
Guard against recursive lower bounds in constraints
We could get an indirect recursion going through a singleton type before. Fixes #21535 [Cherry-picked d0ea3b0]
- Loading branch information
1 parent
b33eb4f
commit 3bfdd87
Showing
3 changed files
with
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-- [E007] Type Mismatch Error: tests/neg/i21535.scala:7:4 -------------------------------------------------------------- | ||
3 | (if (true) then | ||
4 | new A(66) | ||
5 | else | ||
6 | m1() | ||
7 | ).m2(p1 = p); // error | ||
| ^ | ||
| Found: (Int | Short) @uncheckedVariance | ||
| Required: Int & Short | ||
| | ||
| longer explanation available when compiling with `-explain` |
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 @@ | ||
def test() = { | ||
val p = 10.toShort | ||
(if (true) then | ||
new A(66) | ||
else | ||
m1() | ||
).m2(p1 = p); // error | ||
|
||
} | ||
|
||
def m1(): A[Short] = new A(10) | ||
|
||
class A[D](var f: D) { | ||
|
||
def m2(p1: D = f, p2: D = f): Unit = {} | ||
} |