Skip to content

Take advantage of multi-span errors#3273

Merged
garyb merged 2 commits intopurescript:masterfrom
garyb:multi-span-errors
Mar 11, 2018
Merged

Take advantage of multi-span errors#3273
garyb merged 2 commits intopurescript:masterfrom
garyb:multi-span-errors

Conversation

@garyb
Copy link
Copy Markdown
Member

@garyb garyb commented Mar 10, 2018

This fixes CycleInModule not having many positions, and adds all positions for DuplicateModule using the usual form rather than special handling.

This fixes `CycleInModule ` not having many positions, and adds all
positions for `DuplicateModule` using the usual form rather than
special handling
@garyb garyb force-pushed the multi-span-errors branch from 684417b to 7e3d3ff Compare March 11, 2018 12:27
@garyb
Copy link
Copy Markdown
Member Author

garyb commented Mar 11, 2018

This was broken yesterday, but I've fixed it now (missed a case where a NEL was needed).

toModule (CyclicSCC ms) =
throwError
. errorMessage' (getModuleSourceSpan (head ms))
. errorMessage'' (NEL.fromList (fmap getModuleSourceSpan ms))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we avoid the partial NEL.fromList and just pattern match the head out of ms?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I mean, we can... I just figured since we can easily see ms is not empty from the pattern already being covered that it probably wasn't necessary?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I mean we'd just move the partiality into the top level pattern match as that wouldn't match the empty list anymore, but I think fromList is one of those unexpectedly partial functions like maximum...

@garyb garyb merged commit 96ccf1e into purescript:master Mar 11, 2018
@garyb garyb deleted the multi-span-errors branch March 11, 2018 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants