# HG changeset patch # User Adam Chlipala # Date 1286757190 14400 # Node ID 3a845f2ce9e94b92fbd5be7c1d996cd08cf1bdd6 # Parent a6fc03d281708a52e8bf18ca5670e8d2d1b1d592 :::_ notation; switch to TooDeep error message diff -r a6fc03d28170 -r 3a845f2ce9e9 doc/manual.tex --- a/doc/manual.tex Sun Oct 10 15:54:51 2010 -0400 +++ b/doc/manual.tex Sun Oct 10 20:33:10 2010 -0400 @@ -495,7 +495,7 @@ In general, several adjacent $\lambda$ forms may be combined into one, and kind and type annotations may be omitted, in which case they are implicitly included as wildcards. More formally, for constructor-level abstractions, we can define a new non-terminal $b ::= x \mid (x :: \kappa) \mid X$ and allow composite abstractions of the form $\lambda b^+ \Rightarrow c$, elaborating into the obvious sequence of one core $\lambda$ per element of $b^+$. -In some contexts, the parser isn't happy with token sequences like $x :: \_$, to indicate a constructor variable of wildcard kind. In such cases, write the second two tokens as $::\hspace{-.05in}\_$, with no intervening spaces. +In some contexts, the parser isn't happy with token sequences like $x :: \_$, to indicate a constructor variable of wildcard kind. In such cases, write the second two tokens as $::\hspace{-.05in}\_$, with no intervening spaces. Analogous syntax $:::\hspace{-.05in}\_$ is available for implicit constructor arguments. For any signature item or declaration that defines some entity to be equal to $A$ with classification annotation $B$ (e.g., $\mt{val} \; x : B = A$), $B$ and the preceding colon (or similar punctuation) may be omitted, in which case it is filled in as a wildcard. diff -r a6fc03d28170 -r 3a845f2ce9e9 src/elab_err.sig --- a/src/elab_err.sig Sun Oct 10 15:54:51 2010 -0400 +++ b/src/elab_err.sig Sun Oct 10 20:33:10 2010 -0400 @@ -58,6 +58,7 @@ | CRecordFailure of Elab.con * Elab.con * (Elab.con * Elab.con * Elab.con) option | TooLifty of ErrorMsg.span * ErrorMsg.span | TooUnify of Elab.con * Elab.con + | TooDeep val cunifyError : ElabEnv.env -> cunify_error -> unit diff -r a6fc03d28170 -r 3a845f2ce9e9 src/elab_err.sml --- a/src/elab_err.sml Sun Oct 10 15:54:51 2010 -0400 +++ b/src/elab_err.sml Sun Oct 10 20:33:10 2010 -0400 @@ -121,6 +121,7 @@ | CRecordFailure of con * con * (con * con * con) option | TooLifty of ErrorMsg.span * ErrorMsg.span | TooUnify of con * con + | TooDeep fun cunifyError env err = case err of @@ -162,6 +163,7 @@ (ErrorMsg.errorAt (#2 c1) "Substitution in constructor is blocked by a too-deep unification variable"; eprefaces' [("Replacement", p_con env c1), ("Body", p_con env c2)]) + | TooDeep => ErrorMsg.error "Can't reverse-engineer unification variable lifting" datatype exp_error = UnboundExp of ErrorMsg.span * string diff -r a6fc03d28170 -r 3a845f2ce9e9 src/elaborate.sml --- a/src/elaborate.sml Sun Oct 10 15:54:51 2010 -0400 +++ b/src/elaborate.sml Sun Oct 10 20:33:10 2010 -0400 @@ -1079,13 +1079,13 @@ err COccursCheckFailed else (r := SOME (squish nl c2All) - handle CantSquish => err CIncompatible) + handle CantSquish => err (fn _ => TooDeep)) | (_, L'.CUnif (nl, _, _, _, r)) => if occursCon r c1All then err COccursCheckFailed else (r := SOME (squish nl c1All) - handle CantSquish => err CIncompatible) + handle CantSquish => err (fn _ => TooDeep)) | (L'.CUnit, L'.CUnit) => () diff -r a6fc03d28170 -r 3a845f2ce9e9 src/urweb.grm --- a/src/urweb.grm Sun Oct 10 15:54:51 2010 -0400 +++ b/src/urweb.grm Sun Oct 10 20:33:10 2010 -0400 @@ -212,7 +212,7 @@ | STRING of string | INT of Int64.int | FLOAT of Real64.real | CHAR of char | SYMBOL of string | CSYMBOL of string | LPAREN | RPAREN | LBRACK | RBRACK | LBRACE | RBRACE - | EQ | COMMA | COLON | DCOLON | DCOLONWILD | TCOLON | DOT | HASH | UNDER | UNDERUNDER | BAR + | EQ | COMMA | COLON | DCOLON | DCOLONWILD | TCOLON | TCOLONWILD | DOT | HASH | UNDER | UNDERUNDER | BAR | PLUS | MINUS | DIVIDE | DOTDOTDOT | MOD | AT | CON | LTYPE | VAL | REC | AND | FUN | MAP | UNIT | KUNIT | CLASS | DATATYPE | OF @@ -394,7 +394,7 @@ %left ANDALSO %left ORELSE %nonassoc COLON -%nonassoc DCOLON TCOLON +%nonassoc DCOLON TCOLON DCOLONWILD TCOLONWILD %left UNION INTERSECT EXCEPT %right COMMA %right JOIN INNER CROSS OUTER LEFT RIGHT FULL @@ -1111,6 +1111,14 @@ ((ECAbs (kcolon, SYMBOL, kind, e), loc), (TCFun (kcolon, SYMBOL, kind, t), loc)) end) + | LBRACK SYMBOL TCOLONWILD RBRACK (fn (e, t) => + let + val loc = s (LBRACKleft, RBRACKright) + val kind = (KWild, loc) + in + ((ECAbs (Implicit, SYMBOL, kind, e), loc), + (TCFun (Implicit, SYMBOL, kind, t), loc)) + end) | LBRACK cexp TWIDDLE cexp RBRACK(fn (e, t) => let val loc = s (LBRACKleft, RBRACKright) diff -r a6fc03d28170 -r 3a845f2ce9e9 src/urweb.lex --- a/src/urweb.lex Sun Oct 10 15:54:51 2010 -0400 +++ b/src/urweb.lex Sun Oct 10 20:33:10 2010 -0400 @@ -371,6 +371,7 @@ "<=" => (Tokens.LE (pos yypos, pos yypos + size yytext)); ">=" => (Tokens.GE (pos yypos, pos yypos + size yytext)); "," => (Tokens.COMMA (pos yypos, pos yypos + size yytext)); + ":::_" => (Tokens.TCOLONWILD (pos yypos, pos yypos + size yytext)); ":::" => (Tokens.TCOLON (pos yypos, pos yypos + size yytext)); "::_" => (Tokens.DCOLONWILD (pos yypos, pos yypos + size yytext)); "::" => (Tokens.DCOLON (pos yypos, pos yypos + size yytext));