Repository navigation
add type check during eval time - #11475
Merged
Merged
Conversation
WindSoilder
marked this pull request as draft
January 3, 2024 09:30
WindSoilder
marked this pull request as ready for review
January 3, 2024 14:31
kubouch
reviewed
Jan 7, 2024
Contributor
|
Seems good, I just have one question, but otherwise we could merge it after the release. |
WindSoilder
added a commit
that referenced
this pull request
Jan 26, 2024
dmatos2012
pushed a commit
to dmatos2012/nushell
that referenced
this pull request
Feb 20, 2024
# Description Fixes: nushell#11438 Take the following as example: ```nushell def spam [foo: string] { $'foo: ($foo | describe)' } def outer [--foo: string] { spam $foo } outer ``` When we call `outer`, type checker only check the all for `outer`, but doesn't check inside the body of `outer`. This pr is trying to introduce a type checking process through `Type::is_subtype()` during eval time. ## NOTE I'm not really sure if it's easy to make a check inside the body of `outer`. Adding an eval time type checker seems like an easier solution. As a result: `outer` will be caught by runtime, not parse time type checker cc @kubouch # User-Facing Changes After this pr the following call will failed: ```nushell > outer Error: nu::shell::cant_convert × Can't convert to string. ╭─[entry nushell#27:1:1] 1 │ def outer [--foo: any] { 2 │ spam $foo · ──┬─ · ╰── can't convert nothing to string 3 │ } ╰──── ``` # Tests + Formatting Done # After Submitting NaN
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes: #11438
Take the following as example:
When we call
outer, type checker only check the all forouter, but doesn't check inside the body ofouter. This pr is trying to introduce a type checking process throughType::is_subtype()during eval time.NOTE
I'm not really sure if it's easy to make a check inside the body of
outer. Adding an eval time type checker seems like an easier solution. As a result:outerwill be caught by runtime, not parse time type checkercc @kubouch
User-Facing Changes
After this pr the following call will failed:
Tests + Formatting
Done
After Submitting
NaN