Skip to content

making empty list matches list<int> types - #11596

Merged
WindSoilder merged 6 commits into
nushell:mainfrom
WindSoilder:empty_list_matches
Jan 26, 2024
Merged

WindSoilder merged 6 commits into
nushell:mainfrom
WindSoilder:empty_list_matches

Conversation

@WindSoilder

@WindSoilder WindSoilder commented Jan 21, 2024 •

Copy link
Copy Markdown
Contributor

Description

Fixes: #11595

The original issue is caused by #11475, we also need to make empty list matches list type or table type

cc @amtoine

User-Facing Changes

Nan

Tests + Formatting

Done

@WindSoilder WindSoilder changed the title empty list matches list types making empty list matches list<int> types Jan 21, 2024
@kubouch

kubouch commented Jan 25, 2024

Copy link
Copy Markdown
Contributor

I agree we should fix this before 0.90. One thing that concerns me: Should we instead modify .is_subtype() to allow matching an empty list as a list, instead of this ad hoc fix in the evaluator? Tagging @sophiajt because I haven't written any of the typing code.

@WindSoilder

WindSoilder commented Jan 25, 2024 •

Copy link
Copy Markdown
Contributor Author

modify .is_subtype() to allow matching an empty list as a list

Agreed. I think it's a better idea than just fix something in the evaluator.


Edit: but it seems that is_subtype doesn't know about the value itself, pass a value here seems to be a large change, and make it to be a method of Value seems strange either, I'm not sure if it's worth here @kubouch

@amtoine amtoine left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks good locally and i trust the tests you've written, thanks @WindSoilder 🙏

@WindSoilder
WindSoilder merged commit 56acebb into nushell:main Jan 26, 2024
@kubouch

kubouch commented Jan 26, 2024

Copy link
Copy Markdown
Contributor

Yes, you're right, we're doing dynamic type checking. Then, I guess it's OK, although we might want to think about concentrating the dynamic type checking into one place, like in the parser, so it's not spread out all over the place.

@hustcer hustcer added this to the v0.90.0 milestone Feb 3, 2024
dmatos2012 pushed a commit to dmatos2012/nushell that referenced this pull request Feb 20, 2024
# Description
Fixes: nushell#11595

The original issue is caused by nushell#11475, we also need to make empty list
matches `list type` or `table type`

cc @amtoine 

# User-Facing Changes
Nan

# Tests + Formatting
Done
@WindSoilder
WindSoilder deleted the empty_list_matches branch February 27, 2024 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't pass empty list to an parameter which is annotated with list<string>

4 participants