-
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.
Tolarate some faults when copying trees in InlineTreeMap
As a preparatory step the inliner maps the inlined body with a tree type map. This map adjusts the tree and at the same time sets up the environment for typing the tree. But this has the potential that re-typing during copying will fail since the environment is not yet set up correctly. We avoid the problem by ignoring a specific failure (function type in application does not exist) and proceeding with the previous type.
- 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}") |