Skip to content

Commit

Permalink
Revert "fix Maybe(jckarter#1)"
Browse files Browse the repository at this point in the history
This reverts commit 7759f3f.
  • Loading branch information
stepancheg committed Mar 30, 2013
1 parent 7759f3f commit 1a0975a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
9 changes: 2 additions & 7 deletions compiler/evaluator_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,9 @@ static size_t valueToStaticSizeTOrInt(MultiEValuePtr args, unsigned index)
static TypePtr valueToType(MultiEValuePtr args, unsigned index)
{
ObjectPtr obj = valueToStatic(args->values[index]);
if (!obj) {
if (!obj || (obj->objKind != TYPE))
argumentError(index, "expecting a type");
}

if (obj->objKind == TYPE)
return (Type *)obj.ptr();
else
return staticType(obj);
return (Type *)obj.ptr();
}

static TypePtr valueToNumericType(MultiEValuePtr args, unsigned index)
Expand Down
4 changes: 2 additions & 2 deletions lib-clay/core/variants/variants.clay
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ overload __operators__.variantReprType(#V) = VariantRepr[..VariantMembers(V)];

[V,M when Variant?(V)]
VariantMember?(#V, #M) =
VariantMemberIndex(V, #M) < VariantMemberCount(V);
VariantMemberIndex(V, M) < VariantMemberCount(V);


/// @section construct from value of member type
Expand All @@ -35,7 +35,7 @@ alias initializeVariant(#V, x:T) --> returned:V {
[V,T when Variant?(V) and VariantMember?(V, T)]
alias overload V(x:T) = initializeVariant(V, x);

[V,T,..AA when Variant?(V) and VariantMember?(V, #T) and CallDefined?(T, ..AA)]
[V,T,..AA when Variant?(V) and VariantMember?(V, T) and CallDefined?(T, ..AA)]
alias overload V(#T, ..args:AA) = V(T(..args));

private abortInvalidTag(tag:Int) {
Expand Down
4 changes: 0 additions & 4 deletions test/lib-clay/core/maybe/test.clay
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,4 @@ main() = testMain(TestSuite("core.maybe", array(
TestCase("require returns rvalue", -> {
expectTrue(RValue?(require(nothing(Int))));
}),

TestCase("static", -> {
expectEqual(#1, just(Maybe(#1)));
}),
)));

0 comments on commit 1a0975a

Please sign in to comment.