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

Error: can't restrict Array(A | B) to Array(A | B) #14942

Open
Blacksmoke16 opened this issue Aug 24, 2024 · 0 comments
Open

Error: can't restrict Array(A | B) to Array(A | B) #14942

Blacksmoke16 opened this issue Aug 24, 2024 · 0 comments
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:semantic

Comments

@Blacksmoke16
Copy link
Member

module A
end

module B
end

class C
  include A
  include B
end

class Foo
  def initialize(
    types : Array(A | B) = [] of A | B
  )
  end
end

Foo.new # => Error: can't restrict Array(A | B) to Array(A | B)

Having C that includes both A and B seems to confuse the compiler.

@Blacksmoke16 Blacksmoke16 added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:semantic labels Aug 24, 2024
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. topic:compiler:semantic
Projects
None yet
Development

No branches or pull requests

1 participant