Skip to content
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

[+-].nan incorrectly supported? #546

Closed
RedCMD opened this issue May 28, 2024 · 1 comment
Closed

[+-].nan incorrectly supported? #546

RedCMD opened this issue May 28, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@RedCMD
Copy link

RedCMD commented May 28, 2024

Describe the bug
+.nan and -.nan are parsed as .nan

To Reproduce

+.nan: +.nan 
+.nan: +.nan
-.NaN: -.NaN
-.NaN: -.NaN
.NAN: .NAN
.NAN: .NAN

(Github correctly ignores [+-].nan, but also seems to interpret - as seq)

Expected behaviour
[+-].nan should be parsed as type str

tag-resolution

  • Environment: VSCode 1.89
  • yaml: 2.4.2

Additional context
also no error is given when multiple keys are given with the same value of type .nan

image
image

@RedCMD RedCMD added the bug Something isn't working label May 28, 2024
@eemeli
Copy link
Owner

eemeli commented Jun 2, 2024

Not complaining about -.nan and +.nan is indeed a bug.

The lack of errors for multiple NaN keys is because NaN !== NaN in JavaScript, and === is what's used by uniqueKeys: true, the default. If this is important to you, it's possible to use e.g. a SameValueZero implementation as the uniqueKeys option value.

@eemeli eemeli closed this as completed Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants