Skip to content

Commit

Permalink
fix oc lowering with return type annotations
Browse files Browse the repository at this point in the history
fixes #44723
  • Loading branch information
simeonschaub committed Mar 24, 2022
1 parent e0c5e96 commit 2de1bdd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -4119,7 +4119,7 @@ f(x) = yt(x)
(cons (car e)
(map-cl-convert (cdr e) fname lam namemap defined toplevel interp opaq globals))))))))

(define (closure-convert e) (cl-convert e #f #f #f #f #f #f #f))
(define (closure-convert e) (cl-convert e #f #f (table) (table) #f #f #f))

;; pass 5: convert to linear IR

Expand Down Expand Up @@ -4403,7 +4403,10 @@ f(x) = yt(x)
(else
(compile-args (cdr e) break-labels))))
(callex (cons (car e) args)))
(cond (tail (emit-return callex))
(cond (tail (let ((tmp (make-ssavalue)))
;; can't just do (emit-return callex), since we might linearize code twice
(emit `(= ,tmp ,callex))
(emit-return tmp)))
(value callex)
(else (emit callex)))))
((=)
Expand Down
4 changes: 4 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3276,3 +3276,7 @@ end
@test m.Foo.bar === 1
@test Core.get_binding_type(m.Foo, :bar) == Any
end

# issue 44723
demo44723(thunk)::Any = Base.Experimental.@opaque () -> true ? 1 : 2
@test demo44723(7)() == 1

0 comments on commit 2de1bdd

Please sign in to comment.