Request for review: Don't crash on self used before self.init in a call argument (#89615)

Hi everyone!

I'd like to ask for a review and a CI run on PR #89615:

It fixes a compiler crash (issue #88991) when self is used as a call argument before self.init in a delegating initializer. Instead of crashing in SILGen, the compiler now emits the regular definite initialization diagnostic ("'self' used before 'self.init' call").

@kavon reviewed it back in June, and all of the feedback has been addressed: the SGFContext-honoring approach was kept, the suggested comment changes were applied, and regression tests were added for the move-only (~Copyable / consuming), failable-init, and @objc cases. The @objc case lives in a separate objc_interop-gated test so the cross-platform file stays clean on Linux and Windows.

The PR has since been rebased onto current main, but CI hasn't run since the rebase. The only earlier failure was on Windows, caused by a known flaky test (swiftlang/sourcekit-lsp#2687) that has since been fixed.

Could someone with CI access run @swift-ci please test (and please test Windows), or point me to the right person to review it? I'm happy to make any further changes.

Thanks!

@kavon can you take a look when you have a moment?

1 Like

@buildcomcarlos I’ve also invited you to become a member of the Swiftlang organization, which will allow you to trigger CI.

2 Likes

Thank you so much, @tkremenek! I've accepted the invitation, and I really appreciate you kicking off CI and looping in Kavon so quickly.

I'll keep an eye on the CI results and follow up on the PR if anything needs attention. :folded_hands:

1 Like

It’s been a while since I worked on this code, but the fix looks reasonable to me. Since you also added new tests, I approved it. I also kicked off source compat testing since that occasionally uncovers issues. I’ll give Kavon a chance to take a look first, but if all the test pass I’m also happy to merge it.

1 Like