-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add coercion on assignment for optionals that only differ in constnes…
…s of their inner types. Also adding a coercion for ternary expressions that coerces the 2dn expression into the type of the 1st (which we already assume provides the result type). Closes #1143. Closes #1220.
- Loading branch information
Showing
5 changed files
with
45 additions
and
1 deletion.
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
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 @@ | ||
# @TEST-EXEC: ${SPICYC} -j %INPUT >output | ||
# | ||
# @TEST-DOC: Regression test for #1143. | ||
|
||
module Foo; | ||
|
||
type Bar = struct { | ||
wutang: bytes &optional; | ||
}; | ||
|
||
type BarTuple = tuple< | ||
wutang: optional<bytes> | ||
>; | ||
|
||
public function make_bar_tuple(bar: Bar): BarTuple { | ||
local nope: optional<bytes>; | ||
return tuple(bar?.wutang ? optional(bar.wutang) : nope); | ||
} |