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

Undetected error in procedure signature involving non-specialized polymorphic type #2982

Closed
mtarik34b opened this issue Nov 25, 2023 · 1 comment
Labels

Comments

@mtarik34b
Copy link
Contributor

mtarik34b commented Nov 25, 2023

Current behavior:
Procedures fn* don't specify the specialization of the parapoly struct.
fn1 reports on invalid signature, as expected.
fn2 works.
fn3 gives an error when using the argument.
(Error messages in code snippet)

Expected behavior:
The signature proc(s: ^Parapoly_Struct) of fn2 and fn3 should report on invalid signature like fn1 does.

package main

Parapoly_Struct :: struct($T: typeid) {
    entry: T
}

// Error: Invalid use of a non-specialized polymorphic type 'Parapoly_Struct'
fn1 :: proc(s: Parapoly_Struct) {}

// no error.
fn2 :: proc(s: ^Parapoly_Struct) {}

// Error: 's' of type '^Parapoly_Struct' has no field 'entry'
fn3 :: proc(s: ^Parapoly_Struct) {
    s.entry = s.entry
}

main :: proc() {
    s: Parapoly_Struct(int)
    fn1(s)
    fn2(&s)
    fn3(&s)
}

#1079 might be related.

Operating System & Odin Version:
Odin: dev-2023-11:cabaac5a
OS: Ubuntu 22.04.3 LTS, Linux 6.2.0-37-generic
CPU: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
RAM: 15747 MiB

@mtarik34b
Copy link
Contributor Author

Fixed in d85c8f0.

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

No branches or pull requests

1 participant