PRL-PRG / genthat

A record-replay framework for the R programming language
14 stars 8 forks source link

Named list with no elements is serialized without the names attribute #116

Closed fikovnik closed 6 years ago

fikovnik commented 6 years ago
> l <- structure(list(), names=character())
> l
named list()
> .Internal(inspect(l))
@561838ab1758 19 VECSXP g0c0 [NAM(2),ATT] (len=0, tl=0)
ATTRIB:
  @561838ab0828 02 LISTSXP g0c0 [] 
    TAG: @56181ca3a290 01 SYMSXP g1c0 [MARK,NAM(2),LCK,gp=0x6000] "names" (has value)
    @561838ab1b28 16 STRSXP g0c0 [NAM(2)] (len=0, tl=0)
> serialize_value(l)
[1] "list()"
> eval(parse(text=serialize_value(l)))
list()

This fails many tests in jsonlite.