Bug 11527 – JSONValue cannot set values through named fields

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-11-16T02:31:00Z
Last change time
2013-11-20T09:50:43Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2013-11-16T02:31:46Z
Following test cases will throw JSONException in runtime: import std.json; void main() { JSONValue v; v.integer = 1; } Output: std.json.JSONException@std\json.d(91): JSONValue is not an integer This is caused by: https://github.com/D-Programming-Language/phobos/pull/1421
Comment #1 by k.hara.pg — 2013-11-16T02:32:27Z
This is git-head (2.065a) regression.
Comment #2 by k.hara.pg — 2013-11-16T02:41:33Z
Comment #3 by john.loughran.colvin — 2013-11-16T04:43:18Z
I thought this was by design as part of the new API? One of the goals was to add type-safety. auto v = JSONValue(1); and JSONValue v; v.type = JSON_TYPE.INTEGER; v.integer = 1; are both valid.
Comment #4 by github-bugzilla — 2013-11-20T09:50:30Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/5440ea8fbce0cb1147713c2538621f3cf180cd79 fix Issue 11527 - JSONValue cannot set values through named fields https://github.com/D-Programming-Language/phobos/commit/dc4bd532d03a93a4957d3f968a059bfe704be463 Merge pull request #1693 from 9rnsr/fix11527 [REG2.065a] Issue 11527 - JSONValue cannot set values through named fields