-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Semantic diffings for functor types and applications (#9331)
This commit improves the error messages for ill-typed functor applications and inclusion between functor types. It does so by computing a diff between the expected and the provided types, and find an application that minimizes the error. The set of changes also paves the way for better diff for inclusion checks between signatures. * Implement a generic and variadic Wagner–Fischer algorithm for computing locally optimal paths. * Compute a full error tree for module type inclusion and equality errors * Improve the error message for module type equality * Expand the error message at the module level by using a diffing algorithm to analyze erroneous functor multi-applications or inclusions using Levenshtein distance. Co-authored-by: Florian Angeletti <florian.angeletti@inria.fr> Co-authored-by: octachron <octa@polychoron.fr>
- Loading branch information
1 parent
3ef9ce8
commit d4dd566
Showing
33 changed files
with
4,497 additions
and
843 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
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
34 changes: 15 additions & 19 deletions
34
testsuite/tests/typing-modules-bugs/pr7414_2_bad.compilers.reference
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,16 @@ | ||
File "pr7414_2_bad.ml", line 46, characters 28-34: | ||
File "pr7414_2_bad.ml", line 46, characters 22-35: | ||
46 | let module Ignore = Force(Choose) in | ||
^^^^^^ | ||
Error: Signature mismatch: | ||
Modules do not match: | ||
functor () -> sig module Choice : T val r : '_weak1 list ref ref end | ||
is not included in | ||
functor () -> S | ||
At position functor () -> <here> | ||
Modules do not match: | ||
sig module Choice : T val r : '_weak1 list ref ref end | ||
is not included in | ||
S | ||
At position functor () -> <here> | ||
Values do not match: | ||
val r : '_weak1 list ref ref | ||
is not included in | ||
val r : Choice.t list ref ref | ||
File "pr7414_2_bad.ml", line 29, characters 2-31: Expected declaration | ||
File "pr7414_2_bad.ml", line 40, characters 8-9: Actual declaration | ||
^^^^^^^^^^^^^ | ||
Error: Modules do not match: | ||
functor () -> sig module Choice : T val r : '_weak1 list ref ref end | ||
is not included in functor () -> S | ||
Modules do not match: | ||
sig module Choice : T val r : '_weak1 list ref ref end | ||
is not included in | ||
S | ||
Values do not match: | ||
val r : '_weak1 list ref ref | ||
is not included in | ||
val r : Choice.t list ref ref | ||
File "pr7414_2_bad.ml", line 29, characters 2-31: Expected declaration | ||
File "pr7414_2_bad.ml", line 40, characters 8-9: Actual declaration |
34 changes: 15 additions & 19 deletions
34
testsuite/tests/typing-modules-bugs/pr7414_bad.compilers.reference
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,16 @@ | ||
File "pr7414_bad.ml", line 52, characters 22-28: | ||
File "pr7414_bad.ml", line 52, characters 16-29: | ||
52 | module Ignore = Force(Choose) | ||
^^^^^^ | ||
Error: Signature mismatch: | ||
Modules do not match: | ||
functor () -> sig module Choice : T val r : '_weak1 list ref ref end | ||
is not included in | ||
functor () -> S | ||
At position functor () -> <here> | ||
Modules do not match: | ||
sig module Choice : T val r : '_weak1 list ref ref end | ||
is not included in | ||
S | ||
At position functor () -> <here> | ||
Values do not match: | ||
val r : '_weak1 list ref ref | ||
is not included in | ||
val r : Choice.t list ref ref | ||
File "pr7414_bad.ml", line 38, characters 2-31: Expected declaration | ||
File "pr7414_bad.ml", line 33, characters 6-7: Actual declaration | ||
^^^^^^^^^^^^^ | ||
Error: Modules do not match: | ||
functor () -> sig module Choice : T val r : '_weak1 list ref ref end | ||
is not included in functor () -> S | ||
Modules do not match: | ||
sig module Choice : T val r : '_weak1 list ref ref end | ||
is not included in | ||
S | ||
Values do not match: | ||
val r : '_weak1 list ref ref | ||
is not included in | ||
val r : Choice.t list ref ref | ||
File "pr7414_bad.ml", line 38, characters 2-31: Expected declaration | ||
File "pr7414_bad.ml", line 33, characters 6-7: Actual declaration |
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.