We've come across a problem with the current way we handle anon fields and anons. Those are encoded on first use, which is convenient because in the general case anon fields might need type parameters from the local context. This works fine if the reader reads everything in order, but with delayed expression reading there can be the following situation:
An anon is first seen, and thus written, inside an expression
It is later seen in a different place, and written as a reference
The reader delays the expression reading, and then comes across the reference place before the definition place
It would be good to have an isolated test case for this, but it's not very easy to find one because this only occurred in a substantial codebase and is affected by the intricacies of type loading.
With this PR we now distinguish between anon fields that require a local context and those that don't. The former are still written immediately, which should work fine because such abstracts cannot appear elsewhere anyway. The latter are stored in the OFD chunk which is then read separately, which should always work because no local context is required. By extension, this applies to anons and the OBD chunk.
We've come across a problem with the current way we handle anon fields and anons. Those are encoded on first use, which is convenient because in the general case anon fields might need type parameters from the local context. This works fine if the reader reads everything in order, but with delayed expression reading there can be the following situation:
It would be good to have an isolated test case for this, but it's not very easy to find one because this only occurred in a substantial codebase and is affected by the intricacies of type loading.
With this PR we now distinguish between anon fields that require a local context and those that don't. The former are still written immediately, which should work fine because such abstracts cannot appear elsewhere anyway. The latter are stored in the OFD chunk which is then read separately, which should always work because no local context is required. By extension, this applies to anons and the OBD chunk.