Skip to content

Commit

Permalink
Fixes #453.
Browse files Browse the repository at this point in the history
  • Loading branch information
Anastassija committed Dec 22, 2013
1 parent acc7722 commit b2c7a58
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,16 @@ MuExp translate(e:(Expression) `<Expression expression> ( <{Expression ","}* arg
if(isConstructorType(t) && isConstructorType(ftype)) {
bindings = match(\tuple([ a | Symbol arg <- getConstructorArgumentTypes(t), label(_,Symbol a) := arg || Symbol a := arg ]),
\tuple([ a | Symbol arg <- getConstructorArgumentTypes(ftype), label(_,Symbol a) := arg || Symbol a := arg ]),());
bindings = bindings + ( name : \void() | /parameter(str name,_) := t, name notin bindings );
return instantiate(t.\adt,bindings) == ftype.\adt;
}
if(isFunctionType(t) && isFunctionType(ftype)) {
bindings = match(getFunctionArgumentTypesAsTuple(t),getFunctionArgumentTypesAsTuple(ftype),());
bindings = bindings + ( name : \void() | /parameter(str name,_) := t, name notin bindings );
return instantiate(t.ret,bindings) == ftype.ret;
}
return false;
} catch invalidMatch(_,_,_): {
} catch invalidMatch(_,_,_): {
return false;
} catch invalidMatch(_,_): {
return false;
Expand All @@ -349,10 +351,12 @@ MuExp translate(e:(Expression) `<Expression expression> ( <{Expression ","}* arg
if(isConstructorType(t) && isConstructorType(alt)) {
bindings = match(\tuple([ a | Symbol arg <- getConstructorArgumentTypes(t), label(_,Symbol a) := arg || Symbol a := arg ]),
\tuple([ a | Symbol arg <- getConstructorArgumentTypes(alt), label(_,Symbol a) := arg || Symbol a := arg ]),());
bindings = bindings + ( name : \void() | /parameter(str name,_) := t, name notin bindings );
return instantiate(t.\adt,bindings) == alt.\adt;
}
if(isFunctionType(t) && isFunctionType(alt)) {
bindings = match(getFunctionArgumentTypesAsTuple(t),getFunctionArgumentTypesAsTuple(alt),());
bindings = bindings + ( name : \void() | /parameter(str name,_) := t, name notin bindings );
return instantiate(t.ret,bindings) == alt.ret;
}
return false;
Expand Down Expand Up @@ -380,7 +384,8 @@ MuExp translate(e:(Expression) `<Expression expression> ( <{Expression ","}* arg
if(isEmpty(resolved)) {
for(int alt <- of.alts) {
t = fuid2type[alt];
println("ALT: <t>");
matches(t);
println("ALT: <t> ftype: <ftype>");
}
throw "ERROR in overloading resolution: <ftype>; <expression@\loc>";
}
Expand Down

0 comments on commit b2c7a58

Please sign in to comment.