mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-23 13:23:47 +00:00
Estimated hours taken: 8 Clean up the handling of unbound type variables. Fix a bug with unbound type variables in lambda expressions. Run purity analysis, modechecking etc. even if there were type errors. compiler/mercury_compile.m: Run purity analysis, modechecking etc. even if there were type errors. This fixes a bug (inconsistency between the code and the comments) that seems to have been introduced in stayl's change to mercury_compile.m (revision 1.25) to add intermodule unused argument elimination: the comment said "continue, even if type checking found errors", but the code did not continue. This change was needed to ensure that we still report a warning message about unused type variables for tests/invalid/error2.m; without it, we stop after type checking and don't do purity analysis, and so don't report the warning. compiler/typecheck.m: compiler/purity.m: Move the code for checking for unbound type variables from typecheck.m to purity.m. It needs to be done *after* type inference has been completed, so it can't be done in the ordinary type checking/inference passes. Add code to purity.m to bind the unbound type variables to the builtin type `void'. compiler/polymorphism.m: Comment out old code to bind unbound type variables to `void'; the old code was incomplete, and this is now done in purity.m. compiler/notes/compiler_design.html: Document the above changes. tests/valid/Mmakefile: tests/valid/unbound_tvar_in_lambda.m: Regression test for the above-mentioned bug with unbound type variables in lambda expressions. tests/warnings/singleton_test.exp: tests/invalid/errors2.err_exp: Change the expected warning message for unbound type variables. The error context is not as precise as it used to be, I'm afraid: we only know which function/predicate the error occurred in, not which clause. Also it now comes out in a different order relative to the other error messages. tests/invalid/errors2.err_exp: tests/invalid/funcs_as_preds.err_exp: Add some new error/warning messages that are output now that we run mode and determinism analysis even if there are type errors.
20 lines
1.3 KiB
Plaintext
20 lines
1.3 KiB
Plaintext
singleton_test.m:022: In clause for predicate `singleton_test:my_append/3':
|
|
singleton_test.m:022: warning: variable `L2' occurs only once in this scope.
|
|
singleton_test.m:026: In clause for function `singleton_test:my_append_func/2':
|
|
singleton_test.m:026: warning: variables `L1, L2' occur only once in this scope.
|
|
singleton_test.m:027: In clause for function `singleton_test:my_append_func/2':
|
|
singleton_test.m:027: warning: variable `T' occurs only once in this scope.
|
|
singleton_test.m:029: In `:- pragma c_code' for predicate `singleton_test:my_c_pred/3':
|
|
singleton_test.m:029: warning: variable `Y' does not occur in the C code.
|
|
singleton_test.m:033: In `:- pragma c_code' for function `singleton_test:my_c_func/2':
|
|
singleton_test.m:033: warning: variable `X' does not occur in the C code.
|
|
singleton_test.m:039: In `:- pragma c_code' for predicate `singleton_test:c_hello_world/3':
|
|
singleton_test.m:039: warning: variable `Msg' does not occur in the C code.
|
|
singleton_test.m:008: In function `singleton_test:my_append_func/2':
|
|
singleton_test.m:008: warning: unresolved polymorphism.
|
|
singleton_test.m:008: The variables with unbound types were:
|
|
singleton_test.m:008: L2 :: V_1
|
|
singleton_test.m:008: L1 :: V_1
|
|
singleton_test.m:008: The unbound type variable(s) will be implicitly
|
|
singleton_test.m:008: bound to the builtin type `void'.
|