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

typeof(fn()) when fn returns void should be legal #14610

Closed
timotheecour opened this issue Jun 8, 2020 · 2 comments
Closed

typeof(fn()) when fn returns void should be legal #14610

timotheecour opened this issue Jun 8, 2020 · 2 comments

Comments

@timotheecour
Copy link
Member

timotheecour commented Jun 8, 2020

typeof(fn()) when fn returns void should be legal

Example

when true:
  proc fn = discard
  type T1 = void # ok
  type T2 = typeof(fn()) # bug: Error: expression 'fn()' has no type (or is ambiguous)

Current Output

Error: expression 'fn()' has no type (or is ambiguous)

Expected Output

works (and T2 is void)

Additional Information

devel 1.3.5 30c09e460778099633db084532672970954bb328

this causes un-necessary workarounds in generic code

@mratsim
Copy link
Collaborator

mratsim commented Jun 10, 2020

Duplicate: #7397

RFC: nim-lang/RFCs#508

(unless we want separate codepaths for type and typeof?)

@timotheecour
Copy link
Member Author

timotheecour commented Jun 10, 2020

ok; it's indeed dup of nim-lang/RFCs#508 ; however I think nim-lang/RFCs#508 can be fixed without having to do RFC nim-lang/RFCs#508

(unless we want separate codepaths for type and typeof?)

no, I didn't intend that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants