Skip to content

[6.2][silgen] Fix a small typo bug I found on inspection. #80970

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

Open
wants to merge 1 commit into
base: release/6.2
Choose a base branch
from

Conversation

gottesmm
Copy link
Contributor

@gottesmm gottesmm commented Apr 21, 2025

Explanation: While looking at making some changes in ResultPlan.cpp, I noticed
that we were performing:

if (auto *b = cast<BeginBorrowInst>(inst)) {

which is very suspicious since cast<> fails on failure rather than failing like
a dyn_cast would. After reviewing the git history, I discovered that this was
clearly a thinko where dyn_cast was actually meant to be used:

if (auto *b = dyn_cast<BeginBorrowInst>(inst)) {

Scope: Just converts a cast that was meant to be a dyn_cast to actually be a
dyn_cast.

Resolves: rdar://149698148

Main PR: #80952

Risk: Low.

Testing: N/A. Correct on sight.

Reviewer: @nate-chandler

We are performing a cast instead of a dyn_cast in an if statement. This will
assert on failure rather than fall through. It seems to be an obvious typo. I
checked in the actual commit in question that introduced it and the intention
was to be a dyn_cast.

rdar://149698148
(cherry picked from commit 132eb93)
@gottesmm gottesmm requested a review from a team as a code owner April 21, 2025 22:22
@gottesmm gottesmm changed the title [silgen] Fix a small typo bug I found on inspection. [6.2][silgen] Fix a small typo bug I found on inspection. Apr 21, 2025
@gottesmm
Copy link
Contributor Author

@swift-ci test

@gottesmm
Copy link
Contributor Author

@swift-ci test macOS platform

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant