-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Changes are located in the new module `TypeMismatch.scala`, as well as in `Show.scala` and `TcDiagnostics.scala` ## Finding mismatches The main logic is entirely contained in `TypeMismatch.scala`. This module operates in two steps: it first finds a mismatch between two types (`findMismatch`) and then formats it (`explainMismatch`). A mismatch is essentially a path in the two types, where the final step is a basic type incompatibility. Because the two types do not necessarily have the same form (because of, e.g., unions), `findMismatch` rebuilds the two types to only keep the incompatibility, building the mismatch path along the way. `explainMismatch` then uses the reconstructed types as well as the mismatch path to provide an explanation, inlining it in the unfolding of the expression's type. ## Scoring `findMismatch` is also based on a basic scoring system: it assigns a matching score (0-100) to the pair of arguments it is given. This system is fairly simple for now, and used only for choosing union candidates (or concluding there is no candidate). In the future, we can build upon it to provide better info to the user, especially with maps and tuples. ## Displaying For now, the new error message and the old error message are displayed together, while we gather user feedback. Reviewed By: ilya-klyuchnikov Differential Revision: D69245458 fbshipit-source-id: aa0f022791a7efd76d0c27739de62544de372de5
- Loading branch information
1 parent
bfd3f5f
commit 863d44a
Showing
70 changed files
with
3,297 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.