Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: MLstate/opalang
...
head fork: MLstate/opalang
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Commits on Oct 02, 2012
@cedricss cedricss [enhance] typer: apply use an injective unification (wip) (see below …
…for more info)

Arguments can have for all when the fun doesn't expect ones.
Here is an example of a typing problem it solves:
--
module MakeQ(X) {
 function f(int v) {
      X.g(v)
  }
}

module M {
  function g(v){ v }
}

Q = MakeQ(M)
--

This fix uses the previous work to enable restricted coercion on module:
w_Unify.ml
--
 | ((W_Algebra.SType_forall schm1), _)
         when is_under_coercion  -> (... specialize schm1...)
--

Todo: rename is_under_coercion by something more general.

Important: note that this patch switches unify_simple_type type arguments. In the unification the order is important.
38bc18b
Showing with 1 addition and 1 deletion.
  1. +1 −1  compiler/libqmlcompil/typer_w/w_Infer.ml
View
2  compiler/libqmlcompil/typer_w/w_Infer.ml
@@ -642,7 +642,7 @@ let rec infer_expr_type ~bypass_typer typing_env original_expr =
arguments in negative part. *)
let tmp_arrow_type = W_CoreTypes.type_arrow args_tys ty_app_result in
W_TypeInfo.add_loc_object tmp_arrow_type.W_Algebra.sty_desc loc ;
- (try W_Unify.unify_simple_type typing_env fun_part_ty tmp_arrow_type
+ (try W_Unify.unify_simple_type_in_coercion typing_env tmp_arrow_type fun_part_ty
with W_Unify.Unification_simple_type_conflict (err_t1, err_t2, detail) ->
raise
(W_InferErrors.Infer_detailled_unification_conflict

No commit comments for this range

Something went wrong with that request. Please try again.