File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -441,15 +441,16 @@ macro generated(f)
441
441
if isa (f, Expr) && (f. head === :function || is_short_function_def (f))
442
442
body = f. args[2 ]
443
443
lno = body. args[1 ]
444
+ tmp = gensym (" tmp" )
444
445
return Expr (:escape ,
445
446
Expr (f. head, f. args[1 ],
446
447
Expr (:block ,
447
448
lno,
448
449
Expr (:if , Expr (:generated ),
449
450
# https://github.com/JuliaLang/julia/issues/25678
450
451
Expr (:block ,
451
- :(local tmp = $ body),
452
- :(if tmp isa Core. CodeInfo; return tmp; else tmp; end )),
452
+ :(local $ tmp = $ body),
453
+ :(if $ tmp isa $ ( GlobalRef ( Core, : CodeInfo)) ; return $ tmp; else $ tmp; end )),
453
454
Expr (:block ,
454
455
Expr (:meta , :generated_only ),
455
456
Expr (:return , nothing ))))))
Original file line number Diff line number Diff line change @@ -2954,6 +2954,21 @@ end
2954
2954
@test f () == (2 , 3 )
2955
2955
end
2956
2956
2957
+ # issue 25678: module of name `Core`
2958
+ # https://github.com/JuliaLang/julia/pull/40778/files#r784416018
2959
+ @test @eval Module () begin
2960
+ Core = 1
2961
+ @generated f () = 1
2962
+ f () == 1
2963
+ end
2964
+
2965
+ # issue 25678: argument of name `tmp`
2966
+ # https://github.com/JuliaLang/julia/pull/43823#discussion_r785365312
2967
+ @test @eval Module () begin
2968
+ @generated f (tmp) = tmp
2969
+ f (1 ) === Int
2970
+ end
2971
+
2957
2972
# issue 42220
2958
2973
macro m42220 ()
2959
2974
return quote
You can’t perform that action at this time.
0 commit comments