|
From: 'Matthew F. v. MLton-c. <mlt...@ml...> - 2026-09-18 01:08:39
|
Branch: refs/heads/master Home: https://github.com/MLton/mlton Commit: cb650477f133978903e2b75fc2ae0afcac848adc https://github.com/MLton/mlton/commit/cb650477f133978903e2b75fc2ae0afcac848adc Author: Matthew Fluet <mat...@gm...> Date: 2026-09-17 (Thu, 17 Sep 2026) Changed paths: M mlton/elaborate/type-env.fun Log Message: ----------- Update `TypeEnv.Type.canUnify` to check equality status of `Unknown`s Fixes MLton/mlton#651 Commit: c08b15196b9acbb832875235dd15b2035ea74bd4 https://github.com/MLton/mlton/commit/c08b15196b9acbb832875235dd15b2035ea74bd4 Author: Matthew Fluet <mat...@gm...> Date: 2026-09-17 (Thu, 17 Sep 2026) Changed paths: M mlton/elaborate/elaborate-core.fun Log Message: ----------- Eliminate unnecessary `? option` in handling of overload resolution Commit: 2c9006bf80486693d1e55121438965f0152cac07 https://github.com/MLton/mlton/commit/2c9006bf80486693d1e55121438965f0152cac07 Author: Matthew Fluet <mat...@gm...> Date: 2026-09-17 (Thu, 17 Sep 2026) Changed paths: M CHANGELOG.adoc Log Message: ----------- Update CHANGELOG.adoc Commit: fa4e23cd3907bc0ad81704d26a5faad82875c83e https://github.com/MLton/mlton/commit/fa4e23cd3907bc0ad81704d26a5faad82875c83e Author: Matthew Fluet <Mat...@gm...> Date: 2026-09-17 (Thu, 17 Sep 2026) Changed paths: M CHANGELOG.adoc M mlton/elaborate/elaborate-core.fun M mlton/elaborate/type-env.fun Log Message: ----------- Merge pull request #652 from MatthewFluet/overload-ice Fix handling of overload resolution with respect to equality types Closes #651. Previously, a use of / (overloaded only for real types) that was constrained to equality types would lead to an internal compiler error: ``` $ cat test.sml fun f (x,y) = (x/y, x=y) $ mlton test.sml MLton 20241230 raised: Fail: ElaborateCore.elabExp: Var:overload unify ``` As noted by @YawarRaza7349 in #651, this is due to a mismatch in `TypeEnv.Type.canUnify` and `TypeEnv.Type.unify`. The former did not check the required equality status of `Unknown` types. The suggested fix does not quite work, because in the case of checking possible overloads, the candidates types are ground types, so `TypeEnv.Type.canUnify` is checking a type with equality-type unknowns (e.g., `''?a * ''?a -> ''?a`) against a ground type (e.g., `real32 * real32 -> real32`). Therefore, checking the equality status is required if either of the arguments to `TypeEnv.Type.canUnify` are `Unknown`. Now, a proper type-checking error is reported: ``` $ mlton test.sml Error: test.sml 1.18-1.18. Variable not overloaded at type: /. type: ??? * ??? -> ??? Warning: test.sml 1.5-1.5. Type of variable was not inferred and could not be generalized: f. type: ??? * ??? -> ??? * bool in: fun f (x, y) = (x / y, x = y) ``` Compare: https://github.com/MLton/mlton/compare/a65f71fdb875...fa4e23cd3907 To unsubscribe from these emails, change your notification settings at https://github.com/MLton/mlton/settings/notifications To unsubscribe from this group and stop receiving emails from it, send an email to mlt...@ml.... |