mirror of
https://github.com/lune-org/lune.git
synced 2024-12-13 13:30:38 +00:00
Fix unification of arg types in unions where one side has nil(s)
This commit is contained in:
parent
a96745c292
commit
41ba23d7ab
2 changed files with 15 additions and 1 deletions
|
@ -142,6 +142,7 @@ impl DefinitionsParser {
|
||||||
results.push(self.convert_parser_item_into_doc_item(top_level_item.clone()));
|
results.push(self.convert_parser_item_into_doc_item(top_level_item.clone()));
|
||||||
}
|
}
|
||||||
self.found_top_level_items = BTreeMap::new();
|
self.found_top_level_items = BTreeMap::new();
|
||||||
|
self.found_top_level_types = HashMap::new();
|
||||||
self.found_top_level_declares = Vec::new();
|
self.found_top_level_declares = Vec::new();
|
||||||
Ok(results)
|
Ok(results)
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,6 +247,16 @@ impl TypeInfoExt for TypeInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn make_empty_type_argument() -> TypeArgument {
|
||||||
|
TypeArgument::new(TypeInfo::Basic(TokenReference::new(
|
||||||
|
vec![],
|
||||||
|
Token::new(TokenType::Symbol {
|
||||||
|
symbol: Symbol::Nil,
|
||||||
|
}),
|
||||||
|
vec![],
|
||||||
|
)))
|
||||||
|
}
|
||||||
|
|
||||||
fn merge_type_arguments(left: TypeArgument, right: TypeArgument) -> TypeArgument {
|
fn merge_type_arguments(left: TypeArgument, right: TypeArgument) -> TypeArgument {
|
||||||
TypeArgument::new(TypeInfo::Union {
|
TypeArgument::new(TypeInfo::Union {
|
||||||
left: Box::new(left.type_info().clone()),
|
left: Box::new(left.type_info().clone()),
|
||||||
|
@ -270,7 +280,10 @@ fn merge_type_argument_vecs(
|
||||||
if let Some(existing) = existing.get(index) {
|
if let Some(existing) = existing.get(index) {
|
||||||
result.push(merge_type_arguments(existing.clone(), argument.clone()));
|
result.push(merge_type_arguments(existing.clone(), argument.clone()));
|
||||||
} else {
|
} else {
|
||||||
result.push(argument.clone());
|
result.push(merge_type_arguments(
|
||||||
|
make_empty_type_argument(),
|
||||||
|
argument.clone(),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result
|
result
|
||||||
|
|
Loading…
Reference in a new issue