Skip to content
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

Pickling issue with CC library #19662

Closed
nicolasstucki opened this issue Feb 9, 2024 · 0 comments · Fixed by #19797
Closed

Pickling issue with CC library #19662

nicolasstucki opened this issue Feb 9, 2024 · 0 comments · Fixed by #19797
Assignees
Labels
area:experimental:cc Capture checking related itype:bug
Milestone

Comments

@nicolasstucki
Copy link
Contributor

Minimization of tests/run/i4523.scala

class C:
  def foo = Seq(5).map { i => i }
sbt> set ThisBuild/Build.scala2Library := Build.Scala2LibraryCCTasty
sbt> scala3-bootstrapped/scalac Test.scala -Ytest-pickler
  exception occurred while compiling List(tests/run/i4523.scala)

  An unhandled exception was thrown in the compiler.
  Please file a crash report here:
  https://github.com/lampepfl/dotty/issues/new/choose
  For non-enriched exceptions, compile with -Yno-enrich-error-messages.

     while compiling: <no file>
        during phase: parser
                mode: Mode(ImplicitsEnabled)
     library version: version 2.13.12
    compiler version: version 3.4.1-RC1-bin-SNAPSHOT-git-7bcfce2
            settings: -Ytest-pickler true -classpath /Users/nicolasstucki/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.12/scala-library-2.13.12.jar:/Users/nicolasstucki/Github/dotty/library/../out/bootstrap/scala3-library-bootstrapped/scala-3.4.1-RC1-bin-SNAPSHOT-nonbootstrapped/scala3-library_3-3.4.1-RC1-bin-SNAPSHOT.jar:/Users/nicolasstucki/Github/dotty/scala2-library-cc-tasty/../out/bootstrap/scala2-library-cc-tasty/scala-3.4.1-RC1-bin-SNAPSHOT-nonbootstrapped/scala2-library-cc-tasty_3-3.4.1-RC1-bin-SNAPSHOT.jar -d /

Exception in thread "main" scala.MatchError: AppliedType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class collection)),object immutable),Seq),List(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object scala),Int))) (of class dotty.tools.dotc.core.Types$CachedAppliedType)
        at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readPathTree$1(TreeUnpickler.scala:1239)
        at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readSimpleTree$1(TreeUnpickler.scala:1309)
        at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTree(TreeUnpickler.scala:1556)
        at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.$anonfun$33(TreeUnpickler.scala:1474)
        at dotty.tools.tasty.TastyReader.until(TastyReader.scala:135)
        at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readLengthTree$1(TreeUnpickler.scala:1474)
        at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTree(TreeUnpickler.scala:1556)
        ...
sbt> set ThisBuild/Build.scala2Library := Build.Scala2LibraryCCTasty
sbt> scala3-bootstrapped/scalac Test.scala -Yprint-tasty
-Yprint-tasty output
**** pickled info of class C
Header:
  version: 28.5.1
  tooling: Scala 3.4.1-RC1-bin-SNAPSHOT-git-7bcfce2
     UUID: 00f7ab37-0348-1ec0-00f7-e5d0d668eb32

Names (399 bytes, starting from 64):
     0: ASTs
     1: <empty>
     2: C
     3: <init>
     4: java
     5: lang
     6: java[Qualified . lang]
     7: Object
     8: java[Qualified . lang][Qualified . Object]
     9: <init>[Signed Signature(List(),java.lang.Object) @<init>]
    10: Unit
    11: scala
    12: foo
    13: Seq
    14: collection
    15: scala[Qualified . collection]
    16: immutable
    17: scala[Qualified . collection][Qualified . immutable]
    18: Int
    19: annotation
    20: scala[Qualified . annotation]
    21: retains
    22: scala[Qualified . annotation][Qualified . retains]
    23: scala[Qualified . collection][Qualified . immutable][Qualified . Seq]
    24: <init>[Signed Signature(List(scala.collection.immutable.Seq),scala.annotation.retains) @<init>]
    25: _root_
    26: Any
    27: f
    28: Function1
    29: <repeated>
    30: map
    31: scala[Qualified . Function1]
    32: map[Signed Signature(List(1, scala.Function1),java.lang.Object) @map]
    33: apply
    34: SeqOps
    35: scala[Qualified . collection][Qualified . SeqOps]
    36: apply[Signed Signature(List(1, scala.collection.immutable.Seq),scala.collection.SeqOps) @apply]
    37: package
    38: Delegate
    39: SeqFactory
    40: SeqFactory[ModuleClass]
    41: IterableOps
    42: $anonfun
    43: i
    44: SourceFile
    45: internal
    46: scala[Qualified . annotation][Qualified . internal]
    47: scala[Qualified . annotation][Qualified . internal][Qualified . SourceFile]
    48: String
    49: java[Qualified . lang][Qualified . String]
    50: <init>[Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @<init>]
    51: tests/run/i4523.scala
    52: Positions
    53: Comments
    54: Attributes


Trees (194 bytes, starting from 466):
     0: PACKAGE(191)
     3:   TERMREFpkg 1 [<empty>]
     5:   TYPEDEF(186) 2 [C]
     9:     TEMPLATE(162)
    12:       APPLY(10)
    14:         SELECTin(8) 9 [<init>[Signed Signature(List(),java.lang.Object) @<init>]]
    17:           NEW
    18:             TYPEREF 7 [Object]
    20:               TERMREFpkg 6 [java[Qualified . lang]]
    22:           SHAREDtype 18
    24:       DEFDEF(7) 3 [<init>]
    27:         EMPTYCLAUSE
    28:         TYPEREF 10 [Unit]
    30:           TERMREFpkg 11 [scala]
    32:         STABLE
    33:       DEFDEF(138) 12 [foo]
    37:         ANNOTATEDtype(58)
    39:           APPLIEDtype(8)
    41:             TYPEREF 13 [Seq]
    43:               TERMREFpkg 17 [scala[Qualified . collection][Qualified . immutable]]
    45:             TYPEREF 18 [Int]
    47:               SHAREDtype 30
    49:           APPLY(46)
    51:             SELECTin(14) 24 [<init>[Signed Signature(List(scala.collection.immutable.Seq),scala.annotation.retains) @<init>]]
    54:               NEW
    55:                 SELECTtpt 21 [retains]
    57:                   SELECT 19 [annotation]
    59:                     SELECT 11 [scala]
    61:                       TERMREFpkg 25 [_root_]
    63:               TYPEREF 21 [retains]
    65:                 TERMREFpkg 20 [scala[Qualified . annotation]]
    67:             TYPED(28)
    69:               REPEATED(18)
    71:                 TYPEREF 26 [Any]
    73:                   TERMREFpkg 11 [scala]
    75:                 SHAREDtype 39
    77:                 IDENT 27 [f]
    79:                   APPLIEDtype(8)
    81:                     TYPEREF 28 [Function1]
    83:                       SHAREDtype 30
    85:                     SHAREDtype 45
    87:                     SHAREDtype 45
    89:               APPLIEDtype(6)
    91:                 TYPEREF 29 [<repeated>]
    93:                   SHAREDtype 73
    95:                 SHAREDtype 71
    97:         APPLY(75)
    99:           TYPEAPPLY(47)
   101:             SELECTin(43) 32 [map[Signed Signature(List(1, scala.Function1),java.lang.Object) @map]]
   104:               APPLY(36)
   106:                 TYPEAPPLY(18)
   108:                   SELECTin(14) 36 [apply[Signed Signature(List(1, scala.collection.immutable.Seq),scala.collection.SeqOps) @apply]]
   111:                     TERMREF 13 [Seq]
   113:                       TERMREF 37 [package]
   115:                         SHAREDtype 30
   117:                     TYPEREF 38 [Delegate]
   119:                       THIS
   120:                         TYPEREF 40 [SeqFactory[ModuleClass]]
   122:                           TERMREFpkg 15 [scala[Qualified . collection]]
   124:                   SHAREDtype 45
   126:                 TYPED(14)
   128:                   REPEATED(4)
   130:                     SHAREDtype 45
   132:                     INTconst 5
   134:                   APPLIEDtype(6)
   136:                     TYPEREF 29 [<repeated>]
   138:                       SHAREDtype 30
   140:                     SHAREDtype 45
   142:               TYPEREF 41 [IterableOps]
   144:                 SHAREDtype 122
   146:             SHAREDtype 45
   148:           BLOCK(24)
   150:             BLOCK(22)
   152:               LAMBDA(3)
   154:                 TERMREFdirect 157
   157:               DEFDEF(15) 42 [$anonfun]
   160:                 PARAM(3) 43 [i]
   163:                   SHAREDtype 45
   165:                 SHAREDtype 45
   167:                 BLOCK(3)
   169:                   TERMREFdirect 160
   172:                 SYNTHETIC
   173:                 ARTIFACT
   174:     ANNOTATION(18)
   176:       TYPEREF 44 [SourceFile]
   178:         TERMREFpkg 46 [scala[Qualified . annotation][Qualified . internal]]
   180:       APPLY(12)
   182:         SELECTin(8) 50 [<init>[Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @<init>]]
   185:           NEW
   186:             SHAREDtype 176
   189:           SHAREDtype 176
   192:         STRINGconst 51 [tests/run/i4523.scala]
   194:

Positions (86 bytes, starting from 662):
  lines: 4
  line sizes:
     0, 8, 33, 0
  positions:
     0: 1 .. 43
     5: 1 .. 43
     9: 12 .. 43
    18: 7 .. 7
    24: 12 .. 12
    28: 12 .. 12
    33: 12 .. 43
    37: 19 .. 19
   101: 22 .. 32
   104: 22 .. 28
   111: 22 .. 25
   124: 22 .. 25
   130: 27 .. 27
   132: 26 .. 27
   134: 27 .. 27
   146: 22 .. 32
   148: 33 .. 43
   154: 41 .. 41
   157: 35 .. 41
   160: 35 .. 36
   163: 36 .. 36
   165: 36 .. 36
   169: 40 .. 41
   180: 1 .. 43
   186: 1 .. 1
   192: 1 .. 1

  source paths:
     0: 51 [tests/run/i4523.scala]


Attributes (2 bytes, starting from 752):
  SOURCEFILEattr 51 [tests/run/i4523.scala]

**** end of pickled info of class C

Originally posted by @nicolasstucki in #19652 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:experimental:cc Capture checking related itype:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants