forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request scala#14894 from dotty-staging/fix-11097
- Loading branch information
Showing
2 changed files
with
14 additions
and
0 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,13 @@ | ||
@main def test: Unit = { | ||
class C { type T1; type T2 } | ||
|
||
def pmatch(s: C): s.T2 = s match { | ||
case p: (C { type T1 = Int; type T2 >: T1 } & s.type) => // error | ||
(3: p.T1): p.T2 | ||
case p: (C { type T1 = String; type T2 >: T1 } & s.type) => // error | ||
("this branch should be matched": p.T1): p.T2 | ||
} | ||
|
||
// ClassCastException: class java.lang.Integer cannot be cast to class java.lang.String | ||
val x = pmatch(new C { type T1 = String; type T2 = String }) | ||
} |