Rename some variables in Checker.cc

This commit is contained in:
Sam Vervaeck 2024-07-11 16:38:41 +02:00
parent 6f7418c784
commit 9578e5d252
Signed by: samvv
SSH key fingerprint: SHA256:dIg0ywU1OP+ZYifrYxy8c5esO72cIKB+4/9wkZj1VaY

View file

@ -324,11 +324,11 @@ std::tuple<ConstraintSet, Type*> Checker::inferTypeExpr(TypeEnv& Env, TypeExpres
case NodeKind::ReferenceTypeExpression: case NodeKind::ReferenceTypeExpression:
{ {
auto E = static_cast<ReferenceTypeExpression*>(TE); auto Ref = static_cast<ReferenceTypeExpression*>(TE);
auto Name = E->Name->getCanonicalText(); auto Name = Ref->Name->getCanonicalText();
auto Match = Env.lookup(Name, SymbolKind::Type); auto Match = Env.lookup(Name, SymbolKind::Type);
if (Match == nullptr) { if (Match == nullptr) {
DE.add<BindingNotFoundDiagnostic>(Name, E->Name); DE.add<BindingNotFoundDiagnostic>(Name, Ref->Name);
Ty = createTVar(); Ty = createTVar();
} else { } else {
Ty = instantiate(Match); Ty = instantiate(Match);
@ -532,11 +532,11 @@ ConstraintSet Checker::inferMany(TypeEnv& Env, std::vector<Node*>& Elements, Typ
solve(Out); solve(Out);
for (auto N: Nodes) { for (auto N: Nodes) {
if (isa<FunctionDeclaration>(N)) { if (isa<FunctionDeclaration>(N)) {
auto M = static_cast<FunctionDeclaration*>(N); auto Func = static_cast<FunctionDeclaration*>(N);
auto Unbound = getUnbound(Env, cast<Declaration>(N)->getType()); auto Unbound = getUnbound(Env, Func->getType());
Env.add( Env.add(
M->getNameAsString(), Func->getNameAsString(),
new TypeScheme { { Unbound.begin(), Unbound.end() }, M->getType() }, new TypeScheme { { Unbound.begin(), Unbound.end() }, Func->getType()->find() },
SymbolKind::Var SymbolKind::Var
); );
} }