Skip to content

[5.7] [Sema] Add fix-it to import RegexBuilder #59779

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

Merged
merged 1 commit into from
Jun 29, 2022

Conversation

hamishknight
Copy link
Contributor

5.7 cherry-pick of #59746

For code such as the following:

let r = Regex {
  /abc/
}

If RegexBuilder has not been imported, emit a specialized diagnostic and fix-it to add import RegexBuilder to the file.

Unfortunately we're currently prevented from emitting the specialized diagnostic in cases where the builder contains references to RegexBuilder types, such as:

let r = Regex {
  Capture {
    /abc/
  }
}

This is due to the fact that we bail from CSGen due to the reference to Capture being turned into an ErrorExpr. We ought to be able to handle solving in the presence of such errors, but for now I'm leaving it as future work.

rdar://93176036

For code such as the following:

```
let r = Regex {
  /abc/
}
```

If RegexBuilder has not been imported, emit a
specialized diagnostic and fix-it to add
`import RegexBuilder` to the file.

Unfortunately we're currently prevented from
emitting the specialized diagnostic in cases where
the builder contains references to RegexBuilder
types, such as:

```
let r = Regex {
  Capture {
    /abc/
  }
}
```

This is due to the fact that we bail from CSGen
due to the reference to `Capture` being turned
into an `ErrorExpr`. We ought to be able to
handle solving in the presence of such errors, but
for now I'm leaving it as future work.

rdar://93176036
@hamishknight hamishknight requested a review from a team as a code owner June 29, 2022 11:10
@hamishknight
Copy link
Contributor Author

@swift-ci please test

@hamishknight hamishknight merged commit 76886c1 into swiftlang:release/5.7 Jun 29, 2022
@hamishknight hamishknight deleted the importance-5.7 branch June 29, 2022 15:43
@AnthonyLatsis AnthonyLatsis added 🍒 release cherry pick Flag: Release branch cherry picks swift 5.7 labels Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.7
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants