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

Compiler: Re-exporting types causes type to take on module name #1758

Closed
spotandjake opened this issue Mar 18, 2023 · 2 comments · Fixed by #1874
Closed

Compiler: Re-exporting types causes type to take on module name #1758

spotandjake opened this issue Mar 18, 2023 · 2 comments · Fixed by #1874

Comments

@spotandjake
Copy link
Member

test.gr

module Main

include "./test1"

from Test1 use { type Test }

test1.gr

module Test1

include "./test2"

from Test2 use { type Test }

provide { type Test }

test2.gr

module Test2

provide enum Test {
  A,
  B,
  C,
}

When you try to compile the program above it gives the error in the provided picture. This seems to be an issue with re-providng types.
image

@spotandjake
Copy link
Member Author

Curiously enough if you use

from Test1 use *
print(A)

it works just fine.

@spotandjake
Copy link
Member Author

I did some digging onto this and it turns out you can import the type by doing.

from Test1 use { type Test2 }

so bassically grain is replacing the type name with the module name,

@spotandjake spotandjake changed the title Compiler: Cant Re-provide Types Compiler: Re-exporting types causes type to take on module name Mar 18, 2023
@phated phated assigned alex-snezhko and unassigned peblair and ospencer Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants