gkossakowski/xsbt — pull request #1 by adriaanm (2012-11-20 02:50:56+00:00)
Title: ZEN 1882: stable representation of refinement type references

explaining the special-casing of references to refinement classes (https://support.typesafe.com/tickets/1882)

goal: a representation of type references to refinement classes that's stable across compilation runs
(and thus insensitive to typing from source or unpickling from bytecode)

problem: the current representation, which corresponds to the owner chain of the refinement:
1. is affected by pickling, so typing from source or using unpickled symbols give different results (because the unpickler "localizes" owners -- this could be fixed in the compiler)
2. can't distinguish multiple refinements in the same owner (this is a limitation of SBT's internal representation and cannot be fixed in the compiler)

potential solutions:
- simply drop the reference: won't work as collapsing all refinement types will cause recompilation to be skipped when a refinement is changed to another refinement
- represent the symbol in the api: can't think of a stable way of referring to an anonymous symbol whose owner changes when pickled
+ expand the reference to the corresponding refinement type: doing that recursively may not terminate, but we can deal with that by approximating recursive references
(all we care about is being sound for recompilation: recompile iff a dependency changes, and this will happen as long as we have one unrolling of the reference to the refinement)

this PR implements the latter solution