Skip to content

Conversation

@milseman
Copy link
Member

@milseman milseman commented Dec 17, 2021

Better printing for our parse errors

@milseman milseman changed the title Better printing for our parse errors Matching engine bug fixes and better printing Dec 17, 2021
Comment on lines 8 to 15
if !savePoints.isEmpty {
var result = "save points:\n"
for point in savePoints {
result += " \(point.describe(in: input))\n"
}
return result
}
return ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: May read better and reduce nesting if we early return with guard.

var description: String {
String(describing: self.destructure)
extension Processor.SavePoint {
func describe(in input: Input) -> String {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func describe(in input: Input) -> String {
func description(in input: Input) -> String {

Nit: The method doesn't have side effects. Therefore suggesting a noun phrase instead of an imperative.

@milseman
Copy link
Member Author

Ok I'm confused. I thought the ME bug fix made it in somewhere else, but if this is what pulls it in fine. Maybe I just don't know how to do pull --rebase 😅

@milseman milseman force-pushed the custom_error_printable branch from efceaa6 to d233b86 Compare December 17, 2021 02:24
@milseman milseman changed the title Matching engine bug fixes and better printing Better error printing Dec 17, 2021
@milseman
Copy link
Member Author

@swift-ci please test linux platform

@milseman milseman merged commit b7b36cd into swiftlang:main Dec 17, 2021
@milseman milseman deleted the custom_error_printable branch December 17, 2021 02:41
Copy link
Contributor

@hamishknight hamishknight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants