mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-03 20:45:49 +01:00
@@ -635,7 +635,7 @@ auto TypeCheckFunDef(const FunctionDefinition* f, TypeEnv types, Env values)
|
||||
// TODO: Check that main doesn't have any parameters.
|
||||
}
|
||||
auto res = TypeCheckStmt(f->body, param_res.types, values, return_type);
|
||||
bool void_return = TypeEqual(return_type, Value::MakeVoidTypeVal());
|
||||
bool void_return = TypeEqual(return_type, Value::MakeUnitTypeVal());
|
||||
auto body = CheckOrEnsureReturn(res.stmt, void_return, f->line_num);
|
||||
return MakeFunDef(f->line_num, f->name, ReifyType(return_type, f->line_num),
|
||||
f->param_pattern, body);
|
||||
|
||||
@@ -272,7 +272,7 @@ auto Value::MakeStructTypeVal(std::string name, VarValues* fields,
|
||||
return v;
|
||||
}
|
||||
|
||||
auto Value::MakeVoidTypeVal() -> const Value* {
|
||||
auto Value::MakeUnitTypeVal() -> const Value* {
|
||||
auto* v = new Value();
|
||||
v->tag = ValKind::TupleV;
|
||||
v->u.tuple.elements = new std::vector<TupleElement>();
|
||||
|
||||
@@ -149,7 +149,7 @@ struct Value {
|
||||
static auto MakePtrTypeVal(const Value* type) -> const Value*;
|
||||
static auto MakeStructTypeVal(std::string name, VarValues* fields,
|
||||
VarValues* methods) -> const Value*;
|
||||
static auto MakeVoidTypeVal() -> const Value*;
|
||||
static auto MakeUnitTypeVal() -> const Value*;
|
||||
static auto MakeChoiceTypeVal(std::string name, VarValues* alts)
|
||||
-> const Value*;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user