carbon-lang
carbon-lang copied to clipboard
Crash with conflicting fn definitions in CheckFunctionTypeMatches()
trafficstars
Description of the bug:
interface Ptr {
let Type:! type;
}
final impl forall [U:! type] U as Ptr where .Type = U* {}
fn F1[T:! Ptr](var t: T) -> T.(Ptr.Type) {
return &t;
}
fn F1[T:! Ptr](var t: T) -> T.Type {
return &t;
}
This crashes the toolchain.
-> 212 CARBON_CHECK(Is<TypedInst>(), "Casting inst {0} to wrong kind {1}", *this,
213 Info::DebugName());
In merge.cpp:265:34
263 auto new_name_id =
264 context.entity_names()
-> 265 .Get(new_param_pattern.As<SemIR::AnyBindingPattern>().entity_name_id)
266 .name_id;
It does As<AnyBindingPattern> but the pattern is VarPattern, which is not a BindingPattern or SymbolicBindingPattern.
What did you do, or what's a simple way to reproduce the bug?
No response
What did you expect to happen?
No response
What actually happened?
No response
Any other information, logs, or outputs that you want to share?
No response