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

Implicit cast fails for generic types #1192

Closed
cbuttner opened this issue May 4, 2024 · 2 comments
Closed

Implicit cast fails for generic types #1192

cbuttner opened this issue May 4, 2024 · 2 comments
Assignees
Labels
Bug Something isn't working Fixed Needs Verification Fixed, but needs verification that it works

Comments

@cbuttner
Copy link
Contributor

cbuttner commented May 4, 2024

module foo(<SIZE>);

struct Chunk {
  char[SIZE] data;
}

struct Chunk_Array {
  Chunk* first;
  Chunk* last;
}

module bar;
import foo;

const SIZE = 16;
def My_Chunk = Chunk(<SIZE>);

fn void tester() {
  Chunk_Array(<SIZE>) array;
  My_Chunk* chunk = array.first;
  //                ^^^^^^^^^^^
  // Error: Implicitly casting 'Chunk(<16>)*' to 'My_Chunk*' (Chunk(<16>)*) is not permitted, but you may do an explicit cast by placing '(My_Chunk*)' before the expression.
}

This seems to occur when at least one of the generic parameters is a constant.

@lerno lerno self-assigned this May 4, 2024
lerno added a commit that referenced this issue May 4, 2024
…wrong parameterized module name causing conversion errors #1192.
@lerno lerno added Bug Something isn't working Fixed Needs Verification Fixed, but needs verification that it works labels May 4, 2024
@lerno
Copy link
Collaborator

lerno commented May 4, 2024

This should now work in master and dev

@cbuttner
Copy link
Contributor Author

cbuttner commented May 7, 2024

Thanks, this fixed it on my end.

@cbuttner cbuttner closed this as completed May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Fixed Needs Verification Fixed, but needs verification that it works
Projects
None yet
Development

No branches or pull requests

2 participants