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

Cross-module refusal of method call syntax for type conversion in generic #14254

Closed
awr1 opened this issue May 6, 2020 · 2 comments · Fixed by #21837
Closed

Cross-module refusal of method call syntax for type conversion in generic #14254

awr1 opened this issue May 6, 2020 · 2 comments · Fixed by #21837
Labels

Comments

@awr1
Copy link
Contributor

awr1 commented May 6, 2020

# importme.nim
type Foo = int32
proc baz*[T](y :int) =
  echo y.Foo
# main.nim
import importme
baz[float](1'i8)

baz[float](1'i8) can be called in importme just fine, but not in main, giving the error:

Error: undeclared field: 'Foo' for type system.int [declared in c:\dev\fork\Nim\lib\system\basic_types.nim(2, 3)] 

Using the normal call syntax allows the code to compile fine, however:

proc baz*[T](y :int) =
  echo Foo(y)
@awr1
Copy link
Contributor Author

awr1 commented May 6, 2020

This issue is also generic-specific, removing the generic param permits compilation.

@timotheecour
Copy link
Member

pretty related: #14819

metagn added a commit to metagn/Nim that referenced this issue May 11, 2023
@metagn metagn mentioned this issue May 11, 2023
metagn added a commit to metagn/Nim that referenced this issue May 19, 2023
Araq pushed a commit that referenced this issue May 20, 2023
* fix #14254

* use temporary PR branch for neo

* fix url
bung87 pushed a commit to bung87/Nim that referenced this issue Jul 29, 2023
* fix nim-lang#14254

* use temporary PR branch for neo

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

Successfully merging a pull request may close this issue.

3 participants