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

Numerical generics cannot be inferred #13110

Closed
BlobCodes opened this issue Feb 24, 2023 · 2 comments · Fixed by #13125
Closed

Numerical generics cannot be inferred #13110

BlobCodes opened this issue Feb 24, 2023 · 2 comments · Fixed by #13125
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. kind:regression Something that used to correctly work but no longer works topic:compiler:generics
Milestone

Comments

@BlobCodes
Copy link
Contributor

Bug Report

Issue

Recently I tried compiling a project I last worked on with crystal v1.6.0. It suddenly did not compile, but I reduced it to the following code which compiles in Crystal v1.6.2, but not on v1.7.2:

struct Foo(A)
end

struct Bar(A)
  def initialize(foo : Foo(A))
  end
end

Bar.new(Foo(3).new)

It shows the following error:

Error: expected argument #1 to 'Bar(A).new' to be Foo(A), not Foo(3)

Overloads are:
 - Bar(A).new(foo : Foo(A))

Debug Information

I tried this both on master and v1.7.2.

$ crystal -v
Crystal 1.7.2 [29f9ac503] (2023-01-23)

LLVM: 13.0.1
Default target: x86_64-unknown-linux-gnu

$ krystal -v
Crystal 1.8.0-dev [072772893] (2023-02-23)

LLVM: 14.0.5
Default target: x86_64-redhat-linux-gnu

$ crystal env
CRYSTAL_CACHE_DIR=/var/home/blobcodes/.cache/crystal
CRYSTAL_PATH=lib:/usr/share/crystal/src
CRYSTAL_VERSION=1.7.2
CRYSTAL_LIBRARY_PATH=/usr/lib64/crystal
CRYSTAL_OPTS='--mcpu native'
@BlobCodes BlobCodes added the kind:bug A bug in the code. Does not apply to documentation, specs, etc. label Feb 24, 2023
@Blacksmoke16 Blacksmoke16 added topic:compiler:generics kind:regression Something that used to correctly work but no longer works labels Feb 24, 2023
@BlobCodes
Copy link
Contributor Author

BlobCodes commented Feb 24, 2023

Commit 33b1920 (#12784) seems to have caused this regression. It works in 6b19d66.

@straight-shoota
Copy link
Member

Resolved by #13125
Why didn't this close automatically? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. kind:regression Something that used to correctly work but no longer works topic:compiler:generics
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants