mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
Merge pull request #6881 from roc-lang/empty-open-union
fix openness inference for empty tag
This commit is contained in:
commit
0d9db5bf2d
2 changed files with 6 additions and 14 deletions
|
@ -968,19 +968,10 @@ fn can_annotation_help(
|
||||||
);
|
);
|
||||||
|
|
||||||
if tags.is_empty() {
|
if tags.is_empty() {
|
||||||
match ext {
|
|
||||||
Some(_) => {
|
|
||||||
// just `a` does not mean the same as `[]`, so even
|
|
||||||
// if there are no fields, still make this a `TagUnion`,
|
|
||||||
// not an EmptyTagUnion
|
|
||||||
Type::TagUnion(
|
Type::TagUnion(
|
||||||
Default::default(),
|
Default::default(),
|
||||||
TypeExtension::from_type(ext_type, is_implicit_openness),
|
TypeExtension::from_type(ext_type, is_implicit_openness),
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
|
||||||
None => Type::EmptyTagUnion,
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
let mut tag_types = can_tags(
|
let mut tag_types = can_tags(
|
||||||
env,
|
env,
|
||||||
|
@ -1173,6 +1164,7 @@ fn can_extension_type(
|
||||||
local_aliases,
|
local_aliases,
|
||||||
references,
|
references,
|
||||||
);
|
);
|
||||||
|
|
||||||
if valid_extension_type(shallow_dealias_with_scope(scope, &ext_type)) {
|
if valid_extension_type(shallow_dealias_with_scope(scope, &ext_type)) {
|
||||||
if matches!(loc_ann.extract_spaces().item, TypeAnnotation::Wildcard)
|
if matches!(loc_ann.extract_spaces().item, TypeAnnotation::Wildcard)
|
||||||
&& matches!(ext_problem_kind, ExtensionTypeKind::TagUnion)
|
&& matches!(ext_problem_kind, ExtensionTypeKind::TagUnion)
|
||||||
|
|
|
@ -3,5 +3,5 @@ app "test" provides [main] to "./platform"
|
||||||
walkHelp : {} -> [Continue {}, Break []]
|
walkHelp : {} -> [Continue {}, Break []]
|
||||||
|
|
||||||
main = when walkHelp {} is
|
main = when walkHelp {} is
|
||||||
# ^^^^^^^^^^^ [Break [], Continue {}]
|
# ^^^^^^^^^^^ [Break []w_a, Continue {}]
|
||||||
Continue {} -> {}
|
Continue {} -> {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue