You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/compiler/snapshots/alma__compiler__tests__Type patterns and pattern matching.snap
+12-13Lines changed: 12 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
source: src/compiler/mod.rs
3
3
assertion_line: 284
4
-
expression: "compile(&[r#\"\nmodule Test exposing (main, Option(Some, None))\n\ntype Option a = Some a | None\n\ntype Id = Id Float\n\ntype List a = Cons a (List a) | Nil\n\ntype Pair a b = Pair a b\n\nmain =\n let\n Id id = Id 1\n test = when Id 5 is\n Id id -> id\n test = when \"test\" is\n\"banana\" -> id\n\"phone\" -> id\n test = when 5 is\n 5 -> id\n _ -> id\n test = when Some(Id(1)) is\n Some (Id id) -> id\n test = when 5 is\n 5 as a -> a\n 1 as b | 2 as b | b -> b\n _ -> id\n test = when Nil is\n Cons a _ |\n Cons (Cons a _) _ |\n Cons (Cons (Cons a _) _) _ -> a\n test = when Pair None (Some 3) is\n Pair (Some (Some (5 as a | 7 as a) | Some (1 as a))) (Some (3 as b | b)) ->\n True\n Some id\n\n\"#])"
4
+
expression: "compile(&[r#\"\nmodule Test exposing (main, Option(Some, None))\n\ntype Option a = Some a | None\n\ntype Id = Id Float\n\ntype List a = Cons a (List a) | Nil\n\ntype Pair a b = Pair a b\n\nmain =\n let\n Id id = Id 1\n test = when Id 5 is\n Id id -> id\n test = when \"test\" is\n\"banana\" -> id\n\"phone\" -> id\n test = when 5 is\n 5 -> id\n _ -> id\n test = when Some(Id(1)) is\n Some (Id id) -> id\n test = when 5 is\n 5 as a -> a\n 1 as b | 2 as b | b -> b\n _ -> id\n test = when Nil is\n Cons a Nil |\n Cons _ (Cons a Nil) |\n Cons _ (Cons _ (Cons a Nil)) -> a\n test = when Pair None (Some 3) is\n Pair (Some (Some (5 as a | 7 as a) | Some (1 as a))) (Some (3 as b | b)) ->\n True\n Some id\n\n\"#])"
5
5
---
6
6
// alma_out/Alma.ffi.js
7
7
@@ -198,8 +198,8 @@ let main = function() {
198
198
let { _0: id } =Id(1)
199
199
let test =function () {
200
200
let __result =Id(5)
201
-
if (__result.__tag==="Id") {
202
-
let { _0: id } =__result
201
+
let id
202
+
if (__result.__tag==="Id"&& (id=__result._0, true)) {
203
203
returnid
204
204
}
205
205
@@ -227,21 +227,20 @@ let main = function() {
227
227
}()
228
228
let test =function () {
229
229
let __result =Some(Id(1))
230
-
if (__result.__tag==="Some"&&__result._0.__tag==="Id") {
231
-
let { _0: { _0: id } } =__result
230
+
let id
231
+
if (__result.__tag==="Some"&&__result._0.__tag==="Id"&& (id=__result._0._0, true)) {
232
232
returnid
233
233
}
234
234
235
235
thrownewError("Incomplete pattern match")
236
236
}()
237
237
let test =function () {
238
238
let __result =5
239
-
if (__result===5) {
240
-
leta =__result
239
+
let a, b
240
+
if (((__result===5) ? (a=__result, true) :false)) {
0 commit comments