Skip to content

Commit 98d928b

Browse files
committed
Call inner helper functions in struct typedef tests
These fixmes have been previously resolved by closure conversion.
1 parent c7c7bde commit 98d928b

File tree

2 files changed

+58
-36
lines changed

2 files changed

+58
-36
lines changed

test/typedefs.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ struct S6
136136
S6_f() = new(42)
137137
138138
"some docs"
139-
S6() = new(42) # FIXME: call S6_f()
139+
S6() = S6_f()
140140
S6(x) = new(x)
141141
end
142142
""") === nothing
@@ -164,7 +164,7 @@ struct S7{S,T}
164164
165165
# Cases where new{...} is called
166166
S7() = new{Int,Int}(10.0, "y5")
167-
S7{UInt8}() = new{UInt8,UInt8}(10.0, "y6") # FIXME: call S7_f()
167+
S7{UInt8}() = S7_f()
168168
S7_f() = new{UInt8,UInt8}(10.0, "y6")
169169
end
170170
""") === nothing

test/typedefs_ir.jl

Lines changed: 56 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ end
816816
struct X
817817
x
818818
f() = new(1)
819-
#X() = f() # FIXME: this X() captures `f` (in flisp, as a Box :-/ )
819+
X() = f() # this X() captures `f` (in flisp, as a Box :-/ )
820820
X(x) = new(x)
821821
X(y,z)::ReallyXIPromise = new(y+z)
822822
"""
@@ -825,7 +825,7 @@ struct X
825825
X(a,b,c) = new(a)
826826
end
827827
#---------------------
828-
1 (newvar slot₂/f)
828+
1 (= slot₂/f (call core.Box))
829829
2 (global TestMod.X)
830830
3 (const TestMod.X)
831831
4 (call core.svec)
@@ -855,35 +855,57 @@ end
855855
28 (call JuliaLowering.eval_closure_type TestMod :#f##0 %₂₆ %₂₇)
856856
29 TestMod.#f##0
857857
30 (new %₂₉)
858-
31 (= slot₂/f %₃₀)
859-
32 TestMod.#f##0
860-
33 (call core.svec %₃₂)
861-
34 (call core.svec)
862-
35 SourceLocation::3:5
863-
36 (call core.svec %₃₃ %₃₄ %₃₅)
864-
37 --- method core.nothing %₃₆
858+
31 slot₂/f
859+
32 (call core.setfield! %₃₁ :contents %₃₀)
860+
33 TestMod.#f##0
861+
34 (call core.svec %₃₃)
862+
35 (call core.svec)
863+
36 SourceLocation::3:5
864+
37 (call core.svec %₃₄ %₃₅ %₃₆)
865+
38 --- method core.nothing %₃₇
865866
slots: [slot₁/#self#(!read)]
866867
1 TestMod.X
867868
2 (new %1)
868869
3 (return %₂)
869-
38 TestMod.X
870-
39 (call core.apply_type core.Type %₃₈)
871-
40 (call core.svec %₃₉ core.Any)
872-
41 (call core.svec)
873-
42 SourceLocation::5:5
874-
43 (call core.svec %₄₀ %₄₁ %₄₂)
875-
44 --- method core.nothing %₄₃
870+
39 TestMod.X
871+
40 (call core.apply_type core.Type %₃₉)
872+
41 (call core.svec %₄₀)
873+
42 (call core.svec)
874+
43 SourceLocation::4:5
875+
44 (call core.svec %₄₁ %₄₂ %₄₃)
876+
45 --- code_info
877+
slots: [slot₁/#ctor-self#(!read) slot₂/f(!read)]
878+
1 (captured_local 1)
879+
2 (call core.isdefined %:contents)
880+
3 (gotoifnot %₂ label₅)
881+
4 (goto label₇)
882+
5 (newvar slot₂/f)
883+
6 slot₂/f
884+
7 (call core.getfield %:contents)
885+
8 (call %₇)
886+
9 (return %₈)
887+
46 slot₂/f
888+
47 (call core.svec %₄₆)
889+
48 (call JuliaLowering.replace_captured_locals! %₄₅ %₄₇)
890+
49 --- method core.nothing %₄₄ %₄₈
891+
50 TestMod.X
892+
51 (call core.apply_type core.Type %₅₀)
893+
52 (call core.svec %₅₁ core.Any)
894+
53 (call core.svec)
895+
54 SourceLocation::5:5
896+
55 (call core.svec %₅₂ %₅₃ %₅₄)
897+
56 --- method core.nothing %₅₅
876898
slots: [slot₁/#ctor-self# slot₂/x]
877899
1 slot₁/#ctor-self#
878900
2 (new %₁ slot₂/x)
879901
3 (return %₂)
880-
45 TestMod.X
881-
46 (call core.apply_type core.Type %₄₅)
882-
47 (call core.svec %₄₆ core.Any core.Any)
883-
48 (call core.svec)
884-
49 SourceLocation::6:5
885-
50 (call core.svec %₄₇ %₄₈ %₄₉)
886-
51 --- method core.nothing %₅₀
902+
57 TestMod.X
903+
58 (call core.apply_type core.Type %₅₇)
904+
59 (call core.svec %₅₈ core.Any core.Any)
905+
60 (call core.svec)
906+
61 SourceLocation::6:5
907+
62 (call core.svec %₅₉ %₆₀ %₆₁)
908+
63 --- method core.nothing %₆₂
887909
slots: [slot₁/#ctor-self# slot₂/y slot₃/z slot₄/tmp(!read)]
888910
1 TestMod.ReallyXIPromise
889911
2 slot₁/#ctor-self#
@@ -899,21 +921,21 @@ end
899921
12 (= slot₄/tmp (call core.typeassert %₁₁ %₁))
900922
13 slot₄/tmp
901923
14 (return %₁₃)
902-
52 TestMod.X
903-
53 (call core.apply_type core.Type %₅₂)
904-
54 (call core.svec %₅₃ core.Any core.Any core.Any)
905-
55 (call core.svec)
906-
56 SourceLocation::10:5
907-
57 (call core.svec %₅₄ %₅₅ %₅₆)
908-
58 --- method core.nothing %₅₇
924+
64 TestMod.X
925+
65 (call core.apply_type core.Type %₆₄)
926+
66 (call core.svec %₆₅ core.Any core.Any core.Any)
927+
67 (call core.svec)
928+
68 SourceLocation::10:5
929+
69 (call core.svec %₆₆ %₆₇ %₆₈)
930+
70 --- method core.nothing %₆₉
909931
slots: [slot₁/#ctor-self# slot₂/a slot₃/b(!read) slot₄/c(!read)]
910932
1 slot₁/#ctor-self#
911933
2 (new %₁ slot₂/a)
912934
3 (return %₂)
913-
59 TestMod.X
914-
60 (call core.apply_type core.Type %₅₉)
915-
61 (call JuliaLowering.bind_docs! %₆₀ "Docs for X constructor\n" %₅₇)
916-
62 (return core.nothing)
935+
71 TestMod.X
936+
72 (call core.apply_type core.Type %₇₁)
937+
73 (call JuliaLowering.bind_docs! %₇₂ "Docs for X constructor\n" %₆₉)
938+
74 (return core.nothing)
917939

918940
########################################
919941
# User defined inner constructors and helper functions for structs with type params

0 commit comments

Comments
 (0)