aboutsummaryrefslogtreecommitdiffstats
path: root/typing.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'typing.cpp')
-rw-r--r--typing.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/typing.cpp b/typing.cpp
index da4f6ed..aba4449 100644
--- a/typing.cpp
+++ b/typing.cpp
@@ -150,9 +150,9 @@ void
ADefinition::constrain(TEnv& tenv, Constraints& c) const
{
if (size() != 3) throw Error("`def' requires exactly 2 arguments", loc);
- const ASymbol* sym = at(1)->to<const ASymbol*>();
- if (!sym)
- throw Error("`def' name is not a symbol", loc);
+ const ASymbol* sym = this->sym();
+ if (!sym) throw Error("`def' has no symbol", loc);
+
AType* tvar = tenv.var(at(2));
tenv.def(sym, make_pair(at(2), tvar));
at(2)->constrain(tenv, c);