-
Notifications
You must be signed in to change notification settings - Fork 10.6k
GSB: Move signature verification from CanGenericSignature::getCanonical() to computeGenericSignature() #36411
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
…al() to computeGenericSignature() Doing this when computing a canonical signature didn't really make sense because canonical signatures are not canonicalized any more strongly _with respect to the builder_; they just canonicalize their requirement types. Instead, let's do these checks after creating the signature in computeGenericSignature(). The old behavior had another undesirable property; since the canonicalization was done by registerGenericSignatureBuilder(), we would always build a new GSB from scratch for every signature we compute. The new location also means we do these checks for protocol requirement signatures as well. This flags an existing fixed crasher where we still emit bogus same-type requirements in the requirement signature, so I moved this test back into an unfixed state.
|
@swift-ci Please smoke test |
|
@swift-ci Please test source compatibility |
|
I looked more into why this PR is regressing on my linux box. This might be helpful: |
I added this test case in swiftlang#36402; the change in swiftlang#36411 correctly flags some bogus same-type requirements in a minimized signature and asserts.
|
@davezarzycki Sorry about that. The new assertion is correct; previously the test used FileCheck to detect the same failure. I'm going to XFAIL it until the other issue flagged by that test is fixed. |
|
Okay. For whatever it may be worth, I was also surprised by the |
|
@davezarzycki The first RUN line checks that some generic signatures minimize correctly. Since they don't currently minimize correctly (FileCheck fails because one of the CHECK: lines is different) I added a 'not' in front of it. The second RUN: line ensures that IRGen can generate code without crashing, which exercises some conformance access path code unrelated to the same-type constraint minimization. I didn't realize the other PR actually turned the first into an assert by enabling some existing asserts in more cases. Once I fix the underlying issue, the assert will be fixed and the FileCheck lines will pass. |
Doing this when computing a canonical signature didn't really
make sense because canonical signatures are not canonicalized
any more strongly with respect to the builder; they just
canonicalize their requirement types.
Instead, let's do these checks after creating the signature in
computeGenericSignature().
The old behavior had another undesirable property; since the
canonicalization was done by registerGenericSignatureBuilder(),
we would always build a new GSB from scratch for every
signature we compute.
The new location also means we do these checks for protocol
requirement signatures as well. This flags an existing fixed
crasher where we still emit bogus same-type requirements in
the requirement signature, so I moved this test back into
an unfixed state.