parent
e0b635e825
commit
1a0081b763
|
@ -6120,6 +6120,15 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod
|
|||
{
|
||||
prev_inst = cur_inst;
|
||||
continue;
|
||||
} else if (prev_type->id == TypeTableEntryIdMaybe &&
|
||||
types_match_const_cast_only(prev_type->data.maybe.child_type, cur_type))
|
||||
{
|
||||
continue;
|
||||
} else if (cur_type->id == TypeTableEntryIdMaybe &&
|
||||
types_match_const_cast_only(cur_type->data.maybe.child_type, prev_type))
|
||||
{
|
||||
prev_inst = cur_inst;
|
||||
continue;
|
||||
} else if (prev_type->id == TypeTableEntryIdNumLitInt ||
|
||||
prev_type->id == TypeTableEntryIdNumLitFloat)
|
||||
{
|
||||
|
|
|
@ -116,4 +116,15 @@ fn returnNullFromMaybeTypeErrorRef() -> %?&A {
|
|||
}
|
||||
fn returnNullLitFromMaybeTypeErrorRef() -> %?&A {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
test "peer type resolution: ?T and T" {
|
||||
assert(??peerTypeTAndMaybeT(true, false) == 0);
|
||||
}
|
||||
fn peerTypeTAndMaybeT(c: bool, b: bool) -> ?usize {
|
||||
if (c) {
|
||||
return if (b) null else usize(0);
|
||||
}
|
||||
|
||||
return usize(3);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user