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

Json: compilation fails with aliased type #9111

Closed
Krognol opened this Issue Sep 28, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@Krognol
Copy link

Krognol commented Sep 28, 2018

import json

type 
    Bar = string
    Foo = object
        a: int
        b: Bar
    
let js = """{"a": 123, "b": "abc"}""".parseJson

echo js.to(Foo)

error

stack trace: (most recent call last)
..\..\C:\nim\lib\pure\json.nim(1466) to
..\..\C:\nim\lib\pure\json.nim(1310) createConstructor
..\..\C:\nim\lib\pure\json.nim(1127) processType
..\..\C:\nim\lib\pure\json.nim(1084) processFields
..\..\C:\nim\lib\pure\json.nim(1042) processObjField
..\..\C:\nim\lib\pure\json.nim(1310) createConstructor
..\..\C:\C:\nim\lib\pure\json.nim(1184) processType
..\..\C:\nim\lib\system.nim(3790) failedAssertImpl
..\..\C:\nim\lib\system.nim(3783) raiseAssert
..\..\C:\nim\lib\system.nim(2830) sysFatal
main.nim(10, 8) template/generic instantiation from here
..\..\C:\nim\lib\system.nim(2830, 7) Error: unhandled exception: C:\nim\lib\pure\json.nim(1184, 18) `false` Unable to process nnkSym Bar

@Araq Araq closed this in 5624036 Sep 29, 2018

Araq added a commit that referenced this issue Sep 29, 2018

Merge pull request #9115 from mashingan/fix-json-aliased
Fix #9111; error when parsing to aliased type field
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment