Closed jemmons closed 6 months ago
Actually, maybe this is a namespace lookup thing? Given this code:
processor Untitled [[ main ]]
{
output stream float out;
struct NoteStruct
{
NotARealThing note;
}
void main()
{
let s = NoteStruct();
advance();
}
}
I’d expect it to emit
Cannot find symbol 'NotARealThing'
But instead I get the same
error: Internal compiler error: "castToRefSkippingReferences:87"
Seems like I get this error for any symbol that’s not in the same namespace as the caller — even if it doesn’t exist.
Yes, looks like an interesting failure case, i'll investigate further
What's going on here is the constant folder is tripping up, as the type is not yet resolved, but it's attempting to check the types of the members too early. This is being triggered by the declaration using the function call type notation. If you change the code to:
processor Untitled [[ main ]]
{
output stream float out;
struct NoteStruct
{
std::notes::NoteOn note;
}
void main()
{
NoteStruct s;
advance();
}
}
it works.
The fix is to ensure the type is resolved before attempting to visit the member types. I'll add a test and a fix for this
Minimum Reproduction Steps
struct
that has astd::notes::NoteOn
member.Of Note
This doesn’t seem to be a general problem with structs in structs. If I make my own nominally equivalent
NoteOn
struct, there’ no error:Workarounds
This only affects initializing struct members via a parenthesized list. Creating a struct and/or directly assigning values works fine: