1.1 --- a/src/compiler/SemanticAnalysis.cpp Mon Nov 19 02:12:13 2012 -0800
1.2 +++ b/src/compiler/SemanticAnalysis.cpp Thu Dec 20 00:59:38 2012 -0800
1.3 @@ -516,16 +516,23 @@
1.4 }
1.5 }
1.6
1.7 - // When we start overloading, coercion will have to happen later.
1.8 - arg = coerce(arg, actual, Coerce_Arg);
1.9 - if (!arg)
1.10 - return;
1.11 + if (actual->isReference()) {
1.12 + // If the actual is a reference, the coercion rules are much
1.13 + // stricter; the contained types must be identical.
1.14 + // :TODO: make this not an assert
1.15 + assert(ReferenceType::cast(actual)->contained() == arg->type());
1.16 + } else {
1.17 + // When we start overloading, coercion will have to happen later.
1.18 + arg = coerce(arg, actual, Coerce_Arg);
1.19 + if (!arg)
1.20 + return;
1.21 + }
1.22
1.23 mustComputeReference = actual->isReference() && !given->isReference();
1.24 }
1.25
1.26 - // :TODO: handle mustComputeReference
1.27 - assert(!mustComputeReference);
1.28 + if (mustComputeReference)
1.29 + arg = new (pool_) HToRef(arg->node(), arg->type(), arg);
1.30
1.31 if (!args->append(arg))
1.32 return;
1.33 @@ -640,6 +647,7 @@
1.34 return l;
1.35 }
1.36
1.37 + // :TODO: remove
1.38 assert(l == r);
1.39
1.40 return left->type();
1.41 @@ -741,8 +749,6 @@
1.42 return NULL;
1.43 return hir;
1.44 }
1.45 -
1.46 - assert(from == to);
1.47
1.48 return hir;
1.49 }