-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Owner discrepancy when compiling from TASTY #3816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Same issue for affects |
We can figure out what's going on by enabling pickle printing and adding some indentation to the printed messages (https://github.com/dotty-staging/dotty/commits/unpickle-debug). The Tasty section looks like 0: PACKAGE(72)
2: TERMREFpkg 1 [<empty>]
4: TYPEDEF(68) 2 [Iterable]
7: TEMPLATE(49)
9: TYPEREF 3 [Object]
11: TERMREFpkg 6 [java[Qualified . lang]]
13: SELFDEF 7 [self]
15: TYPEREFsymbol 4
17: THIS
18: TYPEREFpkg 1 [<empty>]
20: DEFDEF(7) 8 [<init>]
23: PARAMS(0)
25: TYPEREF 9 [Unit]
27: TERMREFpkg 10 [scala]
29: TYPEDEF(27) 11 [CC]
32: TYPEBOUNDStpt(24)
34: TYPEREF 12 [Nothing]
36: SHARED 27
38: REFINEDtpt(18)
40: IDENTtpt 2 [Iterable]
42: SHARED 15
44: TYPEDEF(12) 11 [CC]
47: TYPEBOUNDStpt(9)
49: SHARED 34
51: SELECTtpt 11
53: QUALTHIS
54: IDENTtpt 2 [Iterable]
56: SHARED 15 and the unpickling logs end with: reading def of CC at Addr(29)
reading term TYPEBOUNDStpt at Addr(32)
reading type TYPEREF at Addr(34)
reading type SHARED at Addr(36)
reading type TERMREFpkg at Addr(27)
reading term REFINEDtpt at Addr(38)
refineCls: class <refinement> 3420
reading term IDENTtpt at Addr(40)
reading type SHARED at Addr(42)
reading type TYPEREFsymbol at Addr(15)
reading type THIS at Addr(17)
reading type TYPEREFpkg at Addr(18)
creating symbol CC at Addr(44) with flags
reading def of CC at Addr(44)
reading term TYPEBOUNDStpt at Addr(47)
reading type SHARED at Addr(49)
reading type TYPEREF at Addr(34)
reading type SHARED at Addr(36)
reading term SELECTtpt at Addr(51)
reading term QUALTHIS at Addr(53)
reading term IDENTtpt at Addr(54)
reading type SHARED at Addr(56)
reading def of CC at Addr(29)
reading term TYPEBOUNDStpt at Addr(32)
reading type TYPEREF at Addr(34)
reading type SHARED at Addr(36)
reading term REFINEDtpt at Addr(38)
refineCls: class <refinement> 3422
reading term IDENTtpt at Addr(40)
reading type SHARED at Addr(42)
Exception in thread "main" java.lang.AssertionError: assertion failed: owner discrepancy for type CC#3421, expected: class <refinement>#3422, found: class <refinement>#3420 Notice that there's a loop, we start with This doesn't happen when typing from source because completing a TypeDef involves some complicated logic to avoid cyclic references: https://github.com/lampepfl/dotty/blob/fc983f72e9b760e6c7d8394f9f8f303ebc878417/compiler/src/dotty/tools/dotc/typer/Namer.scala#L1170-L1212 We may need something similar for unpickling. |
Fix #3816: Protect against cycles when unpickling hk types
Compiling the following minimization of
tests/pos/NoCyclicReference.scala
with-Ytest-pickler
fails with
The text was updated successfully, but these errors were encountered: