Skip to content
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

Different type annotations when function is defined once on Julia nightly #530

Open
Zentrik opened this issue Jan 8, 2024 · 2 comments
Open

Comments

@Zentrik
Copy link
Collaborator

Zentrik commented Jan 8, 2024

Note ::Type{Int64} is omitted the first time.

julia> versioninfo()
Julia Version 1.11.0-DEV.1226
Commit 1d3dd859ff8 (2024-01-07 22:06 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 16 × AMD Ryzen 7 1700 Eight-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-15.0.7 (ORCJIT, znver1)
Threads: 1 default, 0 interactive, 1 GC (on 16 virtual cores)

julia> f(x) = Int(x)
f (generic function with 1 method)

julia> using Cthulhu

julia> @descend f(1)
f(x) @ Main REPL[2]:1
1 f(x::Int64)::Int64 = Int(x::Int64)
Select a call to descend into or  to ascend. [q]uit. [b]ookmark.
Toggles: [w]arn, [h]ide type-stable statements, [t]ype annotations, [s]yntax highlight for Source/LLVM/Native, [j]ump to source always.
Show: [S]ource code, [A]ST, [T]yped code, [L]LVM IR, [N]ative code
Actions: [E]dit source code, [R]evise and redisplay
 • Int(x::Int64)
   

julia> f(x) = Int(x)
f (generic function with 1 method)

julia> @descend f(1)
f(x) @ Main REPL[5]:1
1 f(x::Int64)::Int64 = Int::Type{Int64}(x::Int64)
Select a call to descend into or  to ascend. [q]uit. [b]ookmark.
Toggles: [w]arn, [h]ide type-stable statements, [t]ype annotations, [s]yntax highlight for Source/LLVM/Native, [j]ump to source always.
Show: [S]ource code, [A]ST, [T]yped code, [L]LVM IR, [N]ative code
Actions: [E]dit source code, [R]evise and redisplay
 • Int::Type{Int64}(x::Int64)
   
@Zentrik Zentrik changed the title Different type annotations when function is defined once on Julia nightly Different type annotations when function is defined after loading Cthulhu on Julia nightly Jan 8, 2024
@Zentrik Zentrik changed the title Different type annotations when function is defined after loading Cthulhu on Julia nightly Different type annotations when function is defined once on Julia nightly Jan 8, 2024
@Zentrik
Copy link
Collaborator Author

Zentrik commented Jan 8, 2024

Ok it seems that code_typed(f, (Int,); optimize=false) differs between the two definitions. So this likely is a Julia bug if it is one.

@Zentrik Zentrik closed this as completed Jan 8, 2024
@Zentrik Zentrik reopened this Jan 14, 2024
@Zentrik
Copy link
Collaborator Author

Zentrik commented Jan 14, 2024

This isn't planned to be fixed on the Julia side, JuliaLang/julia#52796. It should be fixable by Cthulhu as it seems the problem is there is an indirection in the Int call.

Zentrik added a commit to Zentrik/Cthulhu.jl that referenced this issue Jan 15, 2024
Zentrik added a commit that referenced this issue Feb 5, 2024
Excludes mac as x86 mac is tier 3 for Julia.
Whether `Int64` was used or tests adapted to using `Int` was based on smallness of change.
Includes workaround for Issue #530.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant