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 @@ -574,15 +574,16 @@ macro generated(f)
574
574
if isa (f, Expr) && (f. head === :function || is_short_function_def (f))
575
575
body = f. args[2 ]
576
576
lno = body. args[1 ]
577
+ tmp = gensym (" tmp" )
577
578
return Expr (:escape ,
578
579
Expr (f. head, f. args[1 ],
579
580
Expr (:block ,
580
581
lno,
581
582
Expr (:if , Expr (:generated ),
582
583
# https://github.com/JuliaLang/julia/issues/25678
583
584
Expr (:block ,
584
- :(local tmp = $ body),
585
- :(if tmp isa Core. CodeInfo; return tmp; else tmp; end )),
585
+ :(local $ tmp = $ body),
586
+ :(if $ tmp isa $ ( GlobalRef ( Core, : CodeInfo)) ; return $ tmp; else $ tmp; end )),
586
587
Expr (:block ,
587
588
Expr (:meta , :generated_only ),
588
589
Expr (:return , nothing ))))))
Original file line number Diff line number Diff line change @@ -2981,6 +2981,21 @@ end
2981
2981
@generated g25678 (x) = return :x
2982
2982
@test g25678 (7 ) === 7
2983
2983
2984
+ # issue 25678: module of name `Core`
2985
+ # https://github.com/JuliaLang/julia/pull/40778/files#r784416018
2986
+ @test @eval Module () begin
2987
+ Core = 1
2988
+ @generated f () = 1
2989
+ f () == 1
2990
+ end
2991
+
2992
+ # issue 25678: argument of name `tmp`
2993
+ # https://github.com/JuliaLang/julia/pull/43823#discussion_r785365312
2994
+ @test @eval Module () begin
2995
+ @generated f (tmp) = tmp
2996
+ f (1 ) === Int
2997
+ end
2998
+
2984
2999
# issue #19012
2985
3000
@test Meta. parse (" \U 2200" , raise= false ) == Symbol (" ∀" )
2986
3001
@test Meta. parse (" \U 2203" , raise= false ) == Symbol (" ∃" )
You can’t perform that action at this time.
0 commit comments