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

Possible typer regression in 2.13.10 #16231

Closed
adampauls opened this issue Oct 22, 2022 · 1 comment
Closed

Possible typer regression in 2.13.10 #16231

adampauls opened this issue Oct 22, 2022 · 1 comment
Labels
itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label

Comments

@adampauls
Copy link
Contributor

Compiler version

2.13.8 (with -Xsource:3).

Tested with Scastie using options:

scalacOptions ++= Seq(
  "-deprecation",
  "-Xsource:3",
  "-encoding", "UTF-8",
  "-feature",
  "-unchecked"
)

Minimized code

import scala.collection.{mutable, IterableOnce}
import scala.collection.immutable.{AbstractSet, Set, SetOps}

final case class Foo[-T](components: IndexedSeq[Int])

sealed trait FooTrie[T]
    extends AbstractSet[Foo[T]]
    with SetOps[Foo[T], Set, FooTrie[T]] {

  override def fromSpecific(
      coll: IterableOnce[Foo[T]]
  ): FooTrie[T] = {
    coll.iterator.foldLeft(empty)(_ incl _) // error here
  }

  override def newSpecificBuilder
      : mutable.Builder[Foo[T], FooTrie[T]] = ???

  override def incl(elem: Foo[T]): FooTrie[T] = ???

  override def empty = FooTrie.empty[T]
}

object FooTrie {
  def empty[T]: FooTrie[T] = ???
}

Output

type mismatch;
 found   : scala.collection.immutable.Set[Playground.Foo[T]]
 required: Playground.FooTrie[T]

Expectation

This compiles without -Xsource:3 and it compiled under 2.13.8 with -Xsource:3. It will also compile fine override def empty = FooTrie.empty[T] is changed to override def empty: FooTrie[T] = FooTrie.empty[T]

scala/scala#10160 seems like a possible candidate based on the fact that it is specific to -Xsource:3.

@adampauls adampauls added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Oct 22, 2022
@adampauls
Copy link
Contributor Author

Whoops, wrong repo! Filed scala/bug#12671.

@SethTisue SethTisue closed this as not planned Won't fix, can't repro, duplicate, stale Oct 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label
Projects
None yet
Development

No branches or pull requests

2 participants