-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Hoist CFGState and BBState out of function scope #19510
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks simple enough. I am slightly worried about infecting the struct level namespace here with these constructs. Maybe instead construct a subtype in there that verifies the flow sensitive rules instead?
d9d187d
to
174b8e7
Compare
I've now nested the enum in the struct, that way |
@swift-ci please test |
47676b6
to
794ba57
Compare
MSVC (Version 19.15.26726) has some really wonky behaviour with enums and structs in function scopes. Hoisting them outside seems to work around it.
@swift-ci please test |
1 similar comment
@swift-ci please test |
Build failed |
@swift-ci please test Linux Platform |
@compnerd Is this approved? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
MSVC (Version 19.15.26726) has some really wonky behaviour with enums and
structs in function scopes. Hoisting them outside seems to work around
it.
Here's the error message, I don't at all understand why it would cause this specific error.
Very oddly, commenting out all the
insertResult.first->second
lines (Lines 4536, 4543, 4565) also makes the error message go away.I also see the error in #19303, but since hoisting out BBState is what fixed it, I also had to hoist out CFGState as in that PR.
Also, with this change, Swift successfully now compiles and links (but immediately crashes when run) on Windows building with MSVC on my machine.