Allow simple uses of Self in impls. (#3824)

Per #3714, some of the details here are not yet settled. In particular,
we might want `Self` to come into scope at the start of the definition,
not at the `as` keyword. However, this change allows us to accept the
uncontroversial examples.
This commit is contained in:
Richard Smith
2024-03-27 22:52:45 +00:00
committed by GitHub
parent a79027120a
commit e8cc089b2b
6 changed files with 240 additions and 71 deletions
+3 -4
View File
@@ -47,10 +47,9 @@ static auto CheckAssociatedFunctionImplementation(
return SemIR::InstId::BuiltinError;
}
// TODO: Substitute the `Self` from the `impl` into the type in the interface
// before checking. Also, this should be a semantic check rather than a
// syntactic one. The functions should be allowed to have different signatures
// as long as we can synthesize a suitable thunk.
// TODO: This should be a semantic check rather than a syntactic one. The
// functions should be allowed to have different signatures as long as we can
// synthesize a suitable thunk.
if (!CheckFunctionTypeMatches(context, impl_function_decl->function_id,
interface_function_id, substitutions)) {
return SemIR::InstId::BuiltinError;