daml/language-support
Stephen Compall a6da995ecb
use representational variance for generated Scala classes (#8879)
* variance calculation without references or cycles

* an idea for handling the recursive reference case elegantly

* extra data for resolving constraints from [recursive] references later

* note on TypeVar case

* trying a different delayed resolution

* quagmire

* the problem: we were trying to solve too early and mix reference levels

* force inner delays to be pulled out; squash the delays iteratively

* make the variance result accessible

* phantoms are covariant

* scalafmt

* simplest GenMap test

* reference tests

* factoring

* don't treat covariant reference arguments as phantom

* making the wrong reference in delays was breaking solve steps

* test cons list self-recursion

* more recursion testing

* -> is better for 2-tuples here

* test cumulative variance tracking

* uninhabited types have variance too

* test mutual recursion with lots of indirect references

* trigger for failing case in incremental resolution

* redesign delayed constraints to handle nesting properly, and be much simpler

* integrate variance calculation with rest of Scala codegen

* handle concrete type and all-phantoms cases; test

* add integration test for variance inference

* add changelog

CHANGELOG_BEGIN
- [Scala Codegen] Type parameters used in GenMap keys are now supported.
  See `issue #8879 <https://github.com/digital-asset/daml/pull/8879>`__.
CHANGELOG_END

* proper doc for covariantVars

- suggested by @cocreature; thanks

* remove useless local var

- suggested by @cocreature; thanks

* add another recursive function to capture more invariants

- suggested by @cocreature; thanks

* absence in what

- suggested by @cocreature; thanks

* use Identifier instead of I

- suggested by @cocreature; thanks

* remove unused type vars; make goSdt cleaner

* also precache variance of choice and key-referenced types

- suggested by @cocreature; thanks
2021-03-17 16:47:18 +00:00
..
codegen-common Port the rest of //language-support/... to Scala 2.13 (#8846) 2021-02-15 15:08:00 +01:00
codegen-main Port the rest of //language-support/... to Scala 2.13 (#8846) 2021-02-15 15:08:00 +01:00
hs/bindings LF: release LF 1.12 (#8856) 2021-02-24 21:17:33 +01:00
java Do not require a JWT token for Health and Reflection services [DPP-277] (#8969) 2021-03-03 11:05:35 +00:00
scala use representational variance for generated Scala classes (#8879) 2021-03-17 16:47:18 +00:00
ts Ledger: refactor bazel packaging of tedger test tool (#8894) 2021-02-22 11:41:19 +01:00