-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug in the compilation of nested case-of expressions
Fix a bug in the Elm compiler that caused defective code to be emitted in some cases where a case-of expression was contained in another case-of expression. Also, add a regression test with a scenario that failed in the previous compiler implementation.
- Loading branch information
Showing
3 changed files
with
54 additions
and
15 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
1 change: 1 addition & 0 deletions
1
implement/test-and-train/elm-interactive-scenarios-core/case-of/steps/151/expected-value.txt
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 @@ | ||
{ gamma = 79 } |
30 changes: 30 additions & 0 deletions
30
implement/test-and-train/elm-interactive-scenarios-core/case-of/steps/151/submission.txt
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,30 @@ | ||
let | ||
first_case_of list = | ||
case list of | ||
[] -> | ||
Err "is empty" | ||
|
||
_ -> | ||
Ok { alfa = [ { beta = 79 } ] } | ||
|
||
second_case_of list = | ||
case list of | ||
[] -> | ||
Err "is empty" | ||
|
||
first :: _ -> | ||
Ok { gamma = first.beta } | ||
|
||
in | ||
case first_case_of [ 1, 3 ] of | ||
Err _ -> | ||
"err in first" | ||
|
||
Ok firstRecord -> | ||
case second_case_of firstRecord.alfa of | ||
Err _ -> | ||
"err in second" | ||
|
||
Ok secondRecord -> | ||
secondRecord | ||
|