Skip to content

Inferred result Nothing instead of Any for generated function with abstract signature #31590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vchuravy opened this issue Apr 2, 2019 · 1 comment
Assignees
Labels
compiler:inference Type inference regression Regression in behavior compared to a previous version

Comments

@vchuravy
Copy link
Member

vchuravy commented Apr 2, 2019

Bisected to #31191 I haven't had any luck narrowing this down further / creating a Cassette less reproducer.

On JuliaLabs/Cassette.jl#118

using Cassette

Cassette.@context Ctx
const ctx = Ctx()

x1 = 0
x2  = 0
f() = Cassette.overdub(ctx, Main.:*, Main.x1, Main.x2)

@assert Cassette.overdub(ctx, Main.:*, Main.x1, Main.x2) == 0
julia> @code_typed optimize=false f()
CodeInfo(
1 ─ %1 = Cassette.overdub::Core.Compiler.Const(Cassette.overdub, false)
│   %2 = Main.:*::Core.Compiler.Const(*, false)
│   %3 = Main.x1::Any
│   %4 = Main.x2::Any
│   %5 = (%1)(Main.ctx, %2, %3, %4)::Core.Compiler.Const(nothing, false)
└──      return %5
) => Nothing

Previously:

julia> @code_typed optimize=false f()
CodeInfo(
1 ─ %1 = Cassette.overdub::Core.Compiler.Const(Cassette.overdub, false)
│   %2 = Main.:*::Core.Compiler.Const(*, false)
│   %3 = Main.x1::Any
│   %4 = Main.x2::Any
│   %5 = (%1)(Main.ctx, %2, %3, %4)::Core.Compiler.Const(nothing, false)
└──      return %5
) => Nothing

determining the Core.Compiler.Const(nothing, false) seems false to me. It might be a bug in how Cassette is interacting with the base compiler after #31191, but I couldn't find anything glaringly obvious.

@vchuravy vchuravy added regression Regression in behavior compared to a previous version compiler:inference Type inference labels Apr 2, 2019
@vchuravy
Copy link
Member Author

vchuravy commented Apr 3, 2019

Bug in Cassette's manual creation of a @generated function.

@vchuravy vchuravy closed this as completed Apr 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:inference Type inference regression Regression in behavior compared to a previous version
Projects
None yet
Development

No branches or pull requests

2 participants