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

AbstractDefChecker doesn’t resolve free variables in return type #8766

Open
kimburgess opened this issue Feb 8, 2020 · 2 comments
Open
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:semantic

Comments

@kimburgess
Copy link
Contributor

When declaring an abstract method that has a self-referencing outer type, but free inner such as:

module Functor(T)
  abstract def fmap(&block : T -> U) : Functor(U) forall U
end

A compiler warning - Warning: can't resolve return type Functor(U) - is generated.

It appears that an additional resolution step may be required for free variables before flagging issues.

@kimburgess kimburgess changed the title AbstractDefChecker don't resolve free variables in return type AbstractDefChecker doesn’t resolve free variables in return type Feb 9, 2020
@RX14 RX14 added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:semantic labels Feb 9, 2020
@Blacksmoke16
Copy link
Member

FWIW this won't actually compile anymore due to #9810.

@icy-arctic-fox
Copy link
Contributor

icy-arctic-fox commented Aug 21, 2023

The example code now produces an error - tested with Crystal 1.9.2

It appears that free variables do not work in the return type of abstract defs.

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

Successfully merging a pull request may close this issue.

4 participants