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
Disallow modification of existing table #703
Comments
Actually I think I'm still confused about the whole "create and define" thing for dotted keys. I don't understand why this should be an error:
The way I understand this:
It seems like this example from the spec:
|
I can't say I'm completely confident in my understanding of the spec either, but... I don't think an "implicit table" is the right way to think of this. My understanding is:
The applicable example from the spec is the parts you left out: [fruit]
apple.color = "red"
apple.taste.sweet = true
# [fruit.apple] # INVALID <----- HERE -----<<
# [fruit.apple.taste] # INVALID
[fruit.apple.texture] # you can add sub-tables Hope this helps! |
Thanks! I think the missing piece for me was that the rule for dotted keys within a block (the set of keys between two successive The change in #704 basically marks all tables created as a result of key/values as explicitly defined right before the next block starts. That should allow for redefinition within a block but not outside of it. |
Should be fixed in 696dd25. Thank you! |
Describe the bug
Given:
go-toml
accepts the input as valid:To Reproduce
https://go.dev/play/p/ta8fAwTBsRM
Expected behavior
I expected to see an error since
a.x
is already defined in the first table section.If you add a
y=1
line to the end of the document,go-toml
will complain thatkey y is already defined
. This is correct, but the initial[a.x]
line should trigger an error prior to that.Versions
Additional context
Found while doing differential fuzzing against
toml-dart
.The text was updated successfully, but these errors were encountered: