-
-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[osh] Implement ${a[@]@P}
and make ${a[@]@a}
and ${a[@]@Q}
consistent with Bash
#2210
Merged
+134
−46
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5251613
[spec/var-op-bash] Add failing spec test for `${a[@]@...}`
akinomyoga ee5e3ee
[osh refactor] make prompt.EvalPrompt receive str
akinomyoga c493cd2
[osh] Fix `${a[@]@Q}` connecting words
akinomyoga 91ce829
[osh] Fix `${a[@]@a}` to generate an attribute for each element
akinomyoga 8e8271e
[osh] Implement `${a[@]@P}`
akinomyoga 0653c5e
[spec/var-op-bash] Simplify spec test var-op-bash#16
akinomyoga fda3cd4
[spec/var-op-bash] Turn osh's var-op-bash#15 result to FAIL
akinomyoga File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see that OSH differs from bash because of a quoting difference, which is OK
But it also seems to differ with
a a a
vs.''
?Or maybe that is addressed in a follow-up?
TBH I don't understand the reasons for the evaluation logic - in these cases, my review falls back to "does OSH match bash?"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! Thanks for pointing out this. This is just my oversight. OSH should generate the same result as Bash. Let me think about how we should distinguish array-origin BashArray from
$@
-origin BashArray.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is OK if we fix that later (or even not at all if nobody runs into it, and if bash does not document it)
Sometimes when I encounter a quirk like this, I split it into a separate test case, and then mark it
oils_failures_allowed += 1
That is just a "note for later" (Basically because there seem to be infinite bash implementation details! I think using
@
with a type query is EXTREMELY obscure. I will be surprised if anyone depends on this)So that way the first test case have bash STDOUT === osh STDOUT, which is a nice proprety
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you wait for a while? If it turns out to be easy to fix, I can fix it within this PR. If not, I'll handle it in a separate PR later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to defer it. The best solution could be to introduce a new type to represent the list coming from
$@
, but one might relate it to the forthcoming switching from BashArray to SparseArray. We can discuss that later.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now this is an allowed OSH failure: fda3cd4