[Chapel Merge] Fix JSON input of a non-nilable owned class

Branch: refs/heads/master
Revision: 4bfd1d8
Author: mppf
Log Message:

Merge pull request #16946 from mppf/fix-16945

Fix JSON input of a non-nilable owned class

Resolves #16945

This PR adjusts owned/shared readWriteThis as well as I/O code for
reading and writing classes to better handle nilable and non-nilable
classes.

There are several issues that need attention in the future related to I/O
of classes:

  • nil classes write the 3-byte string "nil" even in binary mode
  • circular graphs of classes will infinite loop when being written
  • the I/O code cannot currently create class instances (instead, it
    reads into the fields of a class instance passed to it)
  • the formatter support (JSON etc) should end up in a different object
    that can be separately implemented (JSON support is just implemented
    directly in the I/O code today)
  • [x] full local futures testing

Reviewed by @e-kayrakli - thanks!

Modified Files:
A test/io/ferguson/issue-16945-error-read-nil-non-nilable.chpl
A test/io/ferguson/issue-16945-error-read-nil-non-nilable.good
A test/io/ferguson/issue-16945-read-nil.chpl
A test/io/ferguson/issue-16945-read-nil.good
A test/io/ferguson/issue-16945.chpl
A test/io/ferguson/issue-16945.good
M modules/internal/OwnedObject.chpl
M modules/internal/SharedObject.chpl
M modules/standard/IO.chpl

Compare: Comparing 7802eceef1c1...4bfd1d8ad6d7 · chapel-lang/chapel · GitHub