You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defcheck_animal(animal : Dog|Cat)
end
check_dog_or_cat(Dog.new)
check_dog_or_cat(Cat.new)
check_dog_or_cat(Bird.new)
Error is expected:
Error in ./src/main.cr:14: no overload matches 'check_animal' with type Bird
Overloads are:
- check_dog_or_cat(animal : Dog | Cat)
check_dog_or_cat(Bird.new)
^~~~~~~~~~~~
But with aliasing Dog | Cat it allows to pass Bird too :S
aliasDogOrCat=Dog|Catdefcheck_alias(animal : DogOrCat)
end
check_alias(Dog.new)
check_alias(Cat.new)
check_alias(Bird.new)
EDIT: Version Crystal 0.18.2 (2016-06-17)
The text was updated successfully, but these errors were encountered:
Hi,
I am new to Crystal and I am still in phase of playing against documentation. I (maybe) found following bug.
Having this code. One class with 3 descendants:
When I want to check type for Dog or Cat:
Error is expected:
But with aliasing
Dog | Cat
it allows to pass Bird too :SEDIT: Version Crystal 0.18.2 (2016-06-17)
The text was updated successfully, but these errors were encountered: