naoina / toml

TOML parser and encoder library for Golang
MIT License
294 stars 50 forks source link

Create explicitly defined table explicitly #15

Closed kezhuw closed 7 years ago

kezhuw commented 8 years ago

Tables with same paths got merged in some cases in old code, while it should be rejected due to duplicated definitions.

I think we should distinguish explicitly created tables from implicitly created tables by some way. So we can detect duplicated explicitly table creation. For now, I uses field Position in ast.Table for this purpose.

Following example is success to decode in old code, while it should be rejected due to duplicated definitions which is not allowed by TOML Spec.

[super.sub]
name = "name"
[super.sub]
value = "value" # Replaces with `name = "xxx"` will got confliction by key "name"
fjl commented 7 years ago

Fixed in commit ec53cec.