From 0900667401415a0914b8a1510543c7c7eaf32e53 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sat, 24 Oct 2026 18:01:36 +0000 Subject: feat(overload): select overloads by return type as well as parameters Co-Authored-By: Claude Opus 5.5 --- lib/CodeGen/ConstructorGen.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/CodeGen/ConstructorGen.cc') diff --git a/lib/CodeGen/ConstructorGen.cc b/lib/CodeGen/ConstructorGen.cc index e956f9d..f598494 100644 --- a/lib/CodeGen/ConstructorGen.cc +++ b/lib/CodeGen/ConstructorGen.cc @@ -20,6 +20,7 @@ void CodeGen::transferObjects(const std::vector &Objects) { Value *CodeGen::emitOwnedValue(ExprAST *Expr, const TypeInfo *Type, std::vector &Transfers) { + expectResult(Expr, Type); if (!Type || (!Type->IsClass && !containsString(Type))) return emitCoercedExpr(Expr, Type); const TypeInfo *Source = getExprTypeInfo(Expr); // A CHAR argument becomes a fresh STRING temporary, owned like any other. @@ -146,6 +147,7 @@ Value *CodeGen::symbolAddress(const SymbolInfo &Info) { void CodeGen::emitAssignment(const LValueInfo &Target, ExprAST *Expr, const SymbolInfo *Symbol) { const TypeInfo *Info = resolveType(Target.TypeName); + expectResult(Expr, Info); if (auto *New = dynamic_cast(Expr)) { SaveAndRestore Location(DiagnosticLine, New->getLine()); const TypeInfo *Class = resolveType(New->getClassName()); -- cgit v1.3.1-4-g156e