-
-
Notifications
You must be signed in to change notification settings - Fork 535
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
using
sometimes doesn't work
#3588
Comments
Weird, I ran the compiler multiple times with |
Can you try on the latest commit now to see if it is fixed? |
The issue is still there. |
I am struggling to replicate this. |
I think it may have to do with out of order compilation. Because my procedure that is trying to |
Here I've uploaded my project so you can test if you would like. sokoban-odin.zip |
I might have an example showing a similar issue. Based on some code in package test
Entity :: struct {
name: string,
derived: union {
Frog,
},
}
Frog :: struct {
using entity: ^Entity,
jump_height: f32,
}
new_entity :: proc($T: typeid) -> ^Entity {
t := new(Entity)
t.derived = T {
entity = t,
}
return t
}
do_something :: proc(e: ^Entity) {
using frog := e.derived.(Frog)
frog.jump_height = 9.0 // Works
jump_height = 10.0 // Works
frog.name = "Froggy" // Works
name = "Froggy" // Error: undeclared name
}
main :: proc() {
entity := new_entity(Frog)
do_something(entity)
} Gives the error: main.odin(30:2) Error: Undeclared name: name
name = "Froggy" // Error: undeclared name
^~~^ Shouldn't btw, having a blast using Odin! 🚀 Edit:
I can confirm I have the same with your project; sometimes it builds, sometimes it gives some errors about using variables.
|
Context
For some reason, occasionally the
using
statement or parameter attribute does not import members correctly.Expected Behavior
Current Behavior
The members of the
Human
struct cannot be found in the scope of the procedure.Failure Information (for bugs)
The text was updated successfully, but these errors were encountered: