-
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.
Merge pull request #14674 from dotty-staging/fix-14653
Tolerate some faults when copying trees in InlineTreeMap
- Loading branch information
Showing
3 changed files
with
31 additions
and
2 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,18 @@ | ||
type Amount = Amount.Type | ||
object Amount: | ||
opaque type Type = BigDecimal | ||
inline def apply(inline dec: BigDecimal): Type = dec | ||
|
||
extension (self: Type) | ||
inline def value: BigDecimal = self | ||
inline def +(y: Type): Type = self + y | ||
|
||
@main def r(): Unit = | ||
val aa: Amount = Amount(1) | ||
val ab: Amount = Amount(2) | ||
val ac: Amount = Amount(2) | ||
val as1: Amount = aa + ab // error | ||
val as2: Amount = aa + ab + ac // error | ||
|
||
println(s"aa + ab = ${as1}") | ||
println(s"aa + ab = ${as2}") |