forked from gleam-lang/gleam
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
check for needs_begin_end_wrapping instead of only checking for pipel…
…ines when emiting single-statement blocks fix gleam-lang#4154
- Loading branch information
1 parent
48e210e
commit 59af3e0
Showing
5 changed files
with
71 additions
and
9 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
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
43 changes: 43 additions & 0 deletions
43
...tests/snapshots/gleam_core__erlang__tests__records__nested_record_update_with_blocks.snap
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,43 @@ | ||
--- | ||
source: compiler-core/src/erlang/tests/records.rs | ||
expression: "pub type A { A(b: B) }\npub type B { B(c: C) }\npub type C { C(val: Int) }\n\npub fn main(a: A) {\n A(..a, b: {\n B(..a.b, c: {\n C(..a.b.c, val: 0)\n })\n })\n}" | ||
--- | ||
----- SOURCE CODE | ||
pub type A { A(b: B) } | ||
pub type B { B(c: C) } | ||
pub type C { C(val: Int) } | ||
|
||
pub fn main(a: A) { | ||
A(..a, b: { | ||
B(..a.b, c: { | ||
C(..a.b.c, val: 0) | ||
}) | ||
}) | ||
} | ||
|
||
----- COMPILED ERLANG | ||
-module(my@mod). | ||
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). | ||
|
||
-export([main/1]). | ||
-export_type([a/0, b/0, c/0]). | ||
|
||
-type a() :: {a, b()}. | ||
|
||
-type b() :: {b, c()}. | ||
|
||
-type c() :: {c, integer()}. | ||
|
||
-file("/root/project/test/my/mod.gleam", 5). | ||
-spec main(a()) -> a(). | ||
main(A) -> | ||
_record = A, | ||
{a, | ||
begin | ||
_record@1 = erlang:element(2, A), | ||
{b, | ||
begin | ||
_record@2 = erlang:element(2, erlang:element(2, A)), | ||
{c, 0} | ||
end} | ||
end}. |