comparison src/elab.sml @ 1639:6c00d8af6239

Add a new scoping check for unification variables, to fix a type inference bug
author Adam Chlipala <adam@chlipala.net>
date Sun, 18 Dec 2011 11:29:13 -0500
parents 5337adf33a4a
children bb942416bf1c
comparison
equal deleted inserted replaced
1638:3bf727a08db8 1639:6c00d8af6239
1 (* Copyright (c) 2008-2010, Adam Chlipala 1 (* Copyright (c) 2008-2011, Adam Chlipala
2 * All rights reserved. 2 * All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met: 5 * modification, are permitted provided that the following conditions are met:
6 * 6 *
36 | KRecord of kind 36 | KRecord of kind
37 | KUnit 37 | KUnit
38 | KTuple of kind list 38 | KTuple of kind list
39 39
40 | KError 40 | KError
41 | KUnif of ErrorMsg.span * string * kind option ref 41 | KUnif of ErrorMsg.span * string * kunif ref
42 | KTupleUnif of ErrorMsg.span * (int * kind) list * kind option ref 42 | KTupleUnif of ErrorMsg.span * (int * kind) list * kunif ref
43 43
44 | KRel of int 44 | KRel of int
45 | KFun of string * kind 45 | KFun of string * kind
46
47 and kunif =
48 KUnknown of kind -> bool (* Is the kind a valid unification? *)
49 | KKnown of kind
46 50
47 withtype kind = kind' located 51 withtype kind = kind' located
48 52
49 datatype explicitness = 53 datatype explicitness =
50 Explicit 54 Explicit
76 80
77 | CTuple of con list 81 | CTuple of con list
78 | CProj of con * int 82 | CProj of con * int
79 83
80 | CError 84 | CError
81 | CUnif of int * ErrorMsg.span * kind * string * con option ref 85 | CUnif of int * ErrorMsg.span * kind * string * cunif ref
86
87 and cunif =
88 Unknown of con -> bool (* Is the constructor a valid unification? *)
89 | Known of con
82 90
83 withtype con = con' located 91 withtype con = con' located
84 92
85 datatype datatype_kind = datatype DatatypeKind.datatype_kind 93 datatype datatype_kind = datatype DatatypeKind.datatype_kind
86 94