Skip to content

-feature -Ycheck:all induces warnings after megaphase following erasure #14637

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

Closed
som-snytt opened this issue Mar 7, 2022 · 0 comments · Fixed by #14675
Closed

-feature -Ycheck:all induces warnings after megaphase following erasure #14637

som-snytt opened this issue Mar 7, 2022 · 0 comments · Fixed by #14675
Assignees
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc itype:bug
Milestone

Comments

@som-snytt
Copy link
Contributor

Compiler version

3.1.1

Minimized code

class C

object Givens:
  given cOrdering: Ordering[C] with
    override def compare(c0: C, c1: C) = 0
  val greeting = "we love Givens"

Output

  scalac -d /tmp -Ycheck:all -feature givens.scala
checking givens.scala after phase typer
checking givens.scala after phase inlinedPositions
checking givens.scala after phase posttyper
checking givens.scala after phase pickler
checking givens.scala after phase inlining
checking givens.scala after phase postInlining
checking givens.scala after phase staging
checking givens.scala after phase pickleQuotes
checking givens.scala after phase MegaPhase{firstTransform, checkReentrant, elimPackagePrefixes, cookComments, checkStatic, checkLoopingImplicits, betaReduce, inlineVals, expandSAMs}
checking givens.scala after phase MegaPhase{elimRepeated, protectedAccessors, extmethods, uncacheGivenAliases, byNameClosures, hoistSuperArgs, specializeApplyMethods, refchecks, tryCatchPatterns, patternMatcher}
checking givens.scala after phase MegaPhase{elimOpaque, explicitOuter, explicitSelf, elimByName, stringInterpolatorOpt}
checking givens.scala after phase MegaPhase{pruneErasedDefs, uninitializedDefs, inlinePatterns, vcInlineMethods, seqLiterals, intercepted, getters, specializeFunctions, liftTry, collectNullableFields, elimOuterSelect, resolveSuper, functionXXLForwarders, paramForwarding, genericTuples, letOverApply, arrayConstructors}
checking givens.scala after phase erasure
checking givens.scala after phase MegaPhase{elimErasedValueType, pureStats, vcElideAllocations, arrayApply, elimPolyFunction, tailrec, completeJavaEnums, mixin, lazyVals, memoize, nonLocalReturns, capturedVars}
-- Feature Warning: givens.scala:5:8 ------------------------------------------------------------------------------------------------------------
5 |  given cOrdering: Ordering[C] with
  |        ^
  |        Definition of implicit conversion method mkOrderingOps should be enabled
  |        by adding the import clause 'import scala.language.implicitConversions'
  |        or by setting the compiler option -language:implicitConversions.
  |        See the Scala docs for value scala.language.implicitConversions for a discussion
  |        why the feature should be explicitly enabled.
checking givens.scala after phase constructors
-- Feature Warning: givens.scala:5:8 ------------------------------------------------------------------------------------------------------------
5 |  given cOrdering: Ordering[C] with
  |        ^
  |        Definition of implicit conversion method mkOrderingOps should be enabled
  |        by adding the import clause 'import scala.language.implicitConversions'
  |        or by setting the compiler option -language:implicitConversions.
  |        See the Scala docs for value scala.language.implicitConversions for a discussion
  |        why the feature should be explicitly enabled.
checking givens.scala after phase MegaPhase{lambdaLift, elimStaticThis, countOuterAccesses}
-- Feature Warning: givens.scala:5:8 ------------------------------------------------------------------------------------------------------------
5 |  given cOrdering: Ordering[C] with
  |        ^
  |        Definition of implicit conversion method mkOrderingOps should be enabled
  |        by adding the import clause 'import scala.language.implicitConversions'
  |        or by setting the compiler option -language:implicitConversions.
  |        See the Scala docs for value scala.language.implicitConversions for a discussion
  |        why the feature should be explicitly enabled.
checking givens.scala after phase MegaPhase{dropOuterAccessors, checkNoSuperThis, flatten, transformWildcards, moveStatic, expandPrivate, restoreScopes, selectStatic, Collect entry points, collectSuperCalls, repeatableAnnotations}
-- Feature Warning: givens.scala:5:8 ------------------------------------------------------------------------------------------------------------
5 |  given cOrdering: Ordering[C] with
  |        ^
  |        Definition of implicit conversion method mkOrderingOps should be enabled
  |        by adding the import clause 'import scala.language.implicitConversions'
  |        or by setting the compiler option -language:implicitConversions.
  |        See the Scala docs for value scala.language.implicitConversions for a discussion
  |        why the feature should be explicitly enabled.
checking givens.scala after phase genSJSIR
-- Feature Warning: givens.scala:5:8 ------------------------------------------------------------------------------------------------------------
5 |  given cOrdering: Ordering[C] with
  |        ^
  |        Definition of implicit conversion method mkOrderingOps should be enabled
  |        by adding the import clause 'import scala.language.implicitConversions'
  |        or by setting the compiler option -language:implicitConversions.
  |        See the Scala docs for value scala.language.implicitConversions for a discussion
  |        why the feature should be explicitly enabled.
checking givens.scala after phase genBCode
-- Feature Warning: givens.scala:5:8 ------------------------------------------------------------------------------------------------------------
5 |  given cOrdering: Ordering[C] with
  |        ^
  |        Definition of implicit conversion method mkOrderingOps should be enabled
  |        by adding the import clause 'import scala.language.implicitConversions'
  |        or by setting the compiler option -language:implicitConversions.
  |        See the Scala docs for value scala.language.implicitConversions for a discussion
  |        why the feature should be explicitly enabled.

Expectation

No feature warning for what I did not write.

[[syntax trees at end of                   erasure]] // givens.scala
package <empty> {
  @SourceFile("givens.scala") class C() extends Object() {}
  final lazy module val Givens: Givens = new Givens()
  @SourceFile("givens.scala") final module class Givens() extends Object() {
    private def writeReplace(): Object = new scala.runtime.ModuleSerializationProxy(classOf[Givens])
    final lazy module given val cOrdering: Givens.cOrdering = new Givens.cOrdering()
    final module class cOrdering() extends Object(), scala.math.Ordering {
      private def writeReplace(): Object = new scala.runtime.ModuleSerializationProxy(classOf[Givens.cOrdering])
      override def compare(c0: C, c1: C): Int = 0
      override def compare(x: Object, y: Object): Int = this.compare(x.asInstanceOf[C], y.asInstanceOf[C])
      def tryCompare(x: Object, y: Object): Option = this.tryCompare(x, y)
      override def reverse(): scala.math.PartialOrdering = this.reverse()
    }
    def greeting(): String = "we love Givens"
  }
}

[[syntax trees at end of MegaPhase{elimErasedValueType, pureStats, vcElideAllocations, arrayApply, elimPolyFunction, tailrec, completeJavaEnums, mixin, lazyVals, memoize, nonLocalReturns, capturedVars}]] // givens.scala
package <empty> {
  @SourceFile("givens.scala") class C() extends Object {
    super()
  }
  final lazy module val Givens: Givens = new Givens()
  @SourceFile("givens.scala") final module class Givens() extends Object {
    super()
    private def writeReplace(): Object = new scala.runtime.ModuleSerializationProxy(classOf[Givens])
    final lazy module given val cOrdering: Givens.cOrdering = new Givens.cOrdering()
    final module class cOrdering() extends Object, scala.math.Ordering {
      super()
      def reversed(): java.util.Comparator = super[Comparator].reversed()
      def thenComparing(x$0: java.util.Comparator): java.util.Comparator = super[Comparator].thenComparing(x$0)
      def thenComparing(x$0: java.util.function.Function, x$1: java.util.Comparator): java.util.Comparator =
        super[Comparator].thenComparing(x$0, x$1)
      def thenComparing(x$0: java.util.function.Function): java.util.Comparator = super[Comparator].thenComparing(x$0)
      def thenComparingInt(x$0: java.util.function.ToIntFunction): java.util.Comparator = super[Comparator].thenComparingInt(x$0)
      def thenComparingLong(x$0: java.util.function.ToLongFunction): java.util.Comparator = super[Comparator].thenComparingLong(x$0)
      def thenComparingDouble(x$0: java.util.function.ToDoubleFunction): java.util.Comparator = super[Comparator].thenComparingDouble(x$0)
      super[PartialOrdering].$init()
      super[Ordering].$init()
      def tryCompare(x: Object, y: Object): Some = super[Ordering].tryCompare(x, y)
      override def lteq(x: Object, y: Object): Boolean = super[Ordering].lteq(x, y)
      override def gteq(x: Object, y: Object): Boolean = super[Ordering].gteq(x, y)
      override def lt(x: Object, y: Object): Boolean = super[Ordering].lt(x, y)
      override def gt(x: Object, y: Object): Boolean = super[Ordering].gt(x, y)
      override def equiv(x: Object, y: Object): Boolean = super[Ordering].equiv(x, y)
      def max(x: Object, y: Object): Object = super[Ordering].max(x, y)
      def min(x: Object, y: Object): Object = super[Ordering].min(x, y)
      override def reverse(): scala.math.Ordering = super[Ordering].reverse()
      def isReverseOf(other: scala.math.Ordering): Boolean = super[Ordering].isReverseOf(other)
      def on(f: Function1): scala.math.Ordering = super[Ordering].on(f)
      def orElse(other: scala.math.Ordering): scala.math.Ordering = super[Ordering].orElse(other)
      def orElseBy(f: Function1, ord: scala.math.Ordering): scala.math.Ordering = super[Ordering].orElseBy(f, ord)
      implicit def mkOrderingOps(lhs: Object): Ordering.this.OrderingOps = super[Ordering].mkOrderingOps(lhs)
      private def writeReplace(): Object = new scala.runtime.ModuleSerializationProxy(classOf[Givens.cOrdering])
      override def compare(c0: C, c1: C): Int = 0
      override def compare(x: Object, y: Object): Int = this.compare(x.asInstanceOf[C], y.asInstanceOf[C])
      def tryCompare(x: Object, y: Object): Option = this.tryCompare(x, y)
      override def reverse(): scala.math.PartialOrdering = this.reverse()
    }
    private val greeting: String = "we love Givens"
    def greeting(): String = Givens.greeting
  }
}
@som-snytt som-snytt added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Mar 7, 2022
@smarter smarter changed the title -feature -check:all induces warnings after megaphase following erasure -feature -Ycheck:all induces warnings after megaphase following erasure Mar 7, 2022
@prolativ prolativ added area:reporting Error reporting including formatting, implicit suggestions, etc and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Mar 9, 2022
@odersky odersky self-assigned this Mar 9, 2022
odersky added a commit to dotty-staging/dotty that referenced this issue Mar 12, 2022
@Kordyjan Kordyjan added this to the 3.1.3 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc itype:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants