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

Failure to load Seq with Scala 2 library TASTy with CC annotations #19586

Closed
nicolasstucki opened this issue Feb 1, 2024 · 3 comments
Closed
Assignees
Labels
area:experimental:cc Capture checking related cc-experiment Intended to be merged with cc-experiment branch on origin itype:bug

Comments

@nicolasstucki
Copy link
Contributor

Followup to #19398.

Minimized code

// Test.scala
class Foo
sbt> set ThisBuild/Build.scala2Library := Build.Scala2LibraryCCTasty
sbt> scala3-bootstrapped/scalac Test.scala

Output

sbt:scala3> scala3-bootstrapped/scalac Test.scala
[info] running (fork) dotty.tools.dotc.Main -d dotty/compiler/../out/default-last-scalac-out.jar -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: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: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 Test.scala
Exception in thread "main"
  unhandled exception while running MegaPhase{elimErasedValueType, pureStats, vcElideAllocations, etaReduce, arrayApply, elimPolyFunction, tailrec, completeJavaEnums, mixin, lazyVals, memoize, nonLocalReturns, capturedVars} on Test.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: Test.scala
        during phase: MegaPhase{elimErasedValueType, pureStats, vcElideAllocations, etaReduce, arrayApply, elimPolyFunction, tailrec, completeJavaEnums, mixin, lazyVals, memoize, nonLocalReturns, capturedVars}
                mode: Mode(ImplicitsEnabled)
     library version: version 2.13.12
    compiler version: version 3.4.1-RC1-bin-SNAPSHOT-git-2b40f55
            settings: -classpath ~/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.12/scala-library-2.13.12.jar: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: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 /
dotty.tools.dotc.core.CyclicReference: Cyclic reference involving trait Seq

 Run with -explain-cyclic for more details.
@nicolasstucki nicolasstucki added itype:bug cc-experiment Intended to be merged with cc-experiment branch on origin labels Feb 1, 2024
@nicolasstucki
Copy link
Contributor Author

nicolasstucki commented Feb 1, 2024

It happens in the arrayApply mini phase.

@odersky
Copy link
Contributor

odersky commented Feb 3, 2024

#19603 fixes the basics and we can now compile most tests.

I tried to go further with

sbt> set ThisBuild/Build.scala2Library := Build.Scala2LibraryCCTasty
sbt> scala3-bootstrapped/testCompilation

Here's the current list of failures:

32 suites passed, 4 failed, 36 total
    tests/neg/i8988.scala failed
    tests/neg/abstract-givens.scala failed
    tests/neg/i18682.scala failed
    tests/run/enrich-gentraversable.scala failed
    tests/run/t5328.scala failed
    tests/run/xml.scala failed
    tests/run/t4332b.scala failed
    tests/run/abstract-givens.scala failed
    tests/run/t2552.scala failed
    tests/run/t2544.scala failed
    tests/run/i16459.scala failed
    tests/run/t6114.scala failed
    tests/pos/i18345.scala failed
    tests/run/t3269.scala failed
    tests/pos/spec-asseenfrom.scala failed
    tests/pos/i19009.case1.scala failed
    tests/pos/i14966a.scala failed
    tests/run/iterables.scala failed
    tests/run/i14582.scala failed
    tests/run/t4054.scala failed
    tests/pos/i14953.scala failed
    tests/run/t5201.scala failed
    tests/run/t6968.scala failed
    tests/run/range-unit.scala failed
    tests/pos/t5120.scala failed
    tests/run/t6271.scala failed
    tests/run/enrich-gentraversable.scala failed
    tests/pos/i1036.scala failed
    tests/pos/t6925.scala failed
    tests/run/Course-2002-10.scala failed
    tests/pos/tyql.scala failed
    tests/run/t4288.scala failed
    tests/run/main-annotation-newMain.scala failed
    tests/run/Pouring.scala failed
    tests/run/t5328.scala failed
    tests/run/t6628.scala failed
    tests/run/arrayview.scala failed
    tests/run/colltest1.scala failed
    tests/pos/gadt-accumulatable.scala failed
    tests/run/t3397.scala failed
    tests/run/t2544.scala failed
    tests/run/i16459.scala failed
    tests/run/t3516.scala failed
    tests/pos/tcpoly_ticket2096.scala failed
    tests/run/t4582.scala failed
    tests/run/i4523.scala failed
    tests/run/iterators.scala failed
    tests/run/stream-stack-overflow-filter-map.scala failed
    tests/pos/t4716.scala failed
    tests/run/streamWithFilter.scala failed
    tests/run/IArrayOps.scala failed
    tests/run/ReverseSeqView.scala failed
    tests/run/viewtest.scala failed
    tests/run/numbereq.scala failed
    tests/run/t3760.scala failed
    tests/run/distinct.scala failed
    tests/run/t4332b.scala failed
    tests/pos/i6199a.scala failed
    tests/run/view-headoption.scala failed
    tests/run/abstract-givens.scala failed
    tests/pos/i9967.scala failed
    tests/pos/i1777.scala failed
    tests/pos/StringContext.scala failed
    tests/run/t4954.scala failed
    tests/pos/i5418.scala failed
    tests/run/t6584.scala failed
    tests/run/extmethods2.scala failed
    tests/pos/t0068.scala failed
    tests/run/kmpSliceSearch.scala failed
    tests/run/patmat-bind-typed.scala failed
    tests/run/t1220.scala failed
    tests/run/t5867.scala failed
    tests/pos/syntaxRewrites.scala failed
    tests/run/forvaleq.scala failed
    tests/pos/t6205.scala failed
    tests/run/Pouring2.scala failed
    tests/run/unittest_iterator.scala failed
    tests/pos/indent-colons.scala failed
    tests/pos/t4717.scala failed
    tests/run/t2552.scala failed
    tests/run/lst failed
    tests/run/t5053.scala failed
    tests/run/lists-run.scala failed
    tests/run/t1074.scala failed
    tests/run/seqlike-kmp.scala failed
    tests/pos/tyql.scala failed
    tests/pos/t6925.scala failed

We need to follow up on this next.

odersky added a commit that referenced this issue Feb 4, 2024
Two measures:

- Introduce a new annotation @retainsCap that's equivalent to
`@retains(cap)` but that does not need to load Seq to analyze a vararg
argument.
- Don't use `&` when computing self types of classes with explicitly
declared capturing self types.

Partial fix of #19586
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Feb 5, 2024
odersky added a commit that referenced this issue Feb 5, 2024
Tests the fixes in #19603. Follow-up of #19586.

Tests `scala3-bootstrapped/testCompilation i3`, this is a subset that
currently works and use to fail.
@nicolasstucki
Copy link
Contributor Author

Moving the followup discussion to #19652.

The original issue is fixed and we have regression tests.

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 cc-experiment Intended to be merged with cc-experiment branch on origin itype:bug
Projects
None yet
Development

No branches or pull requests

3 participants