@calda I looked at the example under -debug-constraints
and I think the main issue here is that guard
statement for some reason is type-checked separately in result builder transform context, that's what we need to fix here.
@ahoppen Looks like this is the issue here https://github.com/apple/swift/blob/main/lib/Sema/ConstraintSystem.cpp#L7112. Should this be set only in code completion mode?
@calda I haven't looked at where this flag gets set but I was hoping that this check you added code be moved there so we end up without this option if solver is not in code completion mode...
Thanks @xedin, that makes sense. I moved the change up to the callsite of the method that configures that option. All the tests pass still with this change.
@ahoppen WDYT?
@swift-ci please test
2651 | 2651 | TypeChecker::applyResultBuilderBodyTransform( | |
2652 | func, builderType)) { | ||
2652 | func, builderType, | ||
2653 | /*ClosuresInResultBuilderDontParticipateInInference=*/ | ||
2654 | false)) { |
@ahoppen Should we flip default to false
maybe instead?
@calda Could you please switch default to false
instead? I think it shouldn't affect tests but I want to run sourcekit stress tester as well.
@swift-ci Please SourceKit stress test
@swift-ci please test
Login to write a write a comment.
This PR fixes an issue with the implementation of SE-0365, where the following code would unexpectedly emit an error:
Fixes #64757, fixes #71040.
Please review: @xedin