-
Notifications
You must be signed in to change notification settings - Fork 1k
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 #13857 from dotty-staging/fix-#13851
Detect opaque aliases in inline val types
- Loading branch information
Showing
5 changed files
with
49 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
opaque type One = 1 | ||
inline val One: One = 1 // error | ||
|
||
opaque type Max = Int.MaxValue.type | ||
inline val Max: Max = Int.MaxValue // error | ||
|
||
inline val MaxValue: Int.MaxValue.type = Int.MaxValue | ||
|
||
opaque type Two = 2 | ||
type Bis = Two | ||
inline val Two: Bis = 2 // error |
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,10 @@ | ||
object Num { | ||
opaque type One = 1 | ||
inline val One: One = 1 // error | ||
|
||
opaque type Two = 2 | ||
inline def Two: Two = 2 | ||
} | ||
|
||
def test1 = Num.One | ||
def test2 = Num.Two |
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 @@ | ||
inline val `1`: 1 = 1 | ||
def get1: 1 = `1` | ||
|
||
opaque type One = 1 | ||
inline val One: One = 1 // error | ||
def getOne: One = One |