Skip to content

Conversation

@hamzaremmal
Copy link
Member

@hamzaremmal hamzaremmal commented Jan 23, 2025

Closes #22440

TODO:

  • Add test with -Wconf
  • Handle desugaring to generate valid code:
  abstract class Base(implicit config: Int)
  case class A(x: Int)(implicit config: Int) extends Base

should not be desugared to (anymore):

abstract class Base(implicit config: Int) extends Object() {
      private[this] implicit val config: Int
    }
    case class A(x: Int)(implicit config: Int) extends Test.Base()(config),
      _root_.scala.Product, _root_.scala.Serializable {
      val x: Int
      private[this] implicit val config: Int
      def copy(x: Int)(implicit config: Int): Test.A = new Test.A(x)(config)
      def copy$default$1: Int @uncheckedVariance = A.this.x
      def _1: Int = this.x
    }
    final lazy module val A: Test.A = new Test.A()
    final module class A() extends AnyRef() { this: Test.A.type =>
      def apply(x: Int)(implicit config: Int): Test.A = new Test.A(x)(config)
      def unapply(x$1: Test.A): Test.A = x$1
      override def toString: String = "A"
    }

but rather:

abstract class Base(implicit config: Int) extends Object() {
      private[this] implicit val config: Int
    }
    case class A(x: Int)(implicit config: Int) extends Test.Base()(using config),
      _root_.scala.Product, _root_.scala.Serializable {
      val x: Int
      private[this] implicit val config: Int
      def copy(x: Int)(implicit config: Int): Test.A = new Test.A(x)(using config)
      def copy$default$1: Int @uncheckedVariance = A.this.x
      def _1: Int = this.x
    }
    final lazy module val A: Test.A = new Test.A()
    final module class A() extends AnyRef() { this: Test.A.type =>
      def apply(x: Int)(implicit config: Int): Test.A = new Test.A(x)(using config)
      def unapply(x$1: Test.A): Test.A = x$1
      override def toString: String = "A"
    }

@hamzaremmal hamzaremmal requested a review from sjrd January 23, 2025 10:14
@hamzaremmal hamzaremmal enabled auto-merge January 23, 2025 10:15
@hamzaremmal hamzaremmal changed the title Implicit parameters should warn at call site under -source future Implicit parameters should warn at call site in >= 3.7 Jan 29, 2025
@hamzaremmal hamzaremmal added release-notes Should be mentioned in the release notes needs-minor-release This PR cannot be merged until the next minor release labels Jan 29, 2025
@hamzaremmal hamzaremmal force-pushed the i22440 branch 2 times, most recently from 52c9fa8 to 8b1be6d Compare January 29, 2025 19:06
@hamzaremmal hamzaremmal disabled auto-merge January 29, 2025 22:06
@hamzaremmal hamzaremmal requested a review from tgodzik February 6, 2025 15:09
@hamzaremmal hamzaremmal enabled auto-merge February 6, 2025 15:44
Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@hamzaremmal hamzaremmal merged commit 7b39421 into scala:main Feb 6, 2025
29 checks passed
@hamzaremmal hamzaremmal deleted the i22440 branch February 6, 2025 21:10
@xuwei-k
Copy link
Contributor

xuwei-k commented Feb 9, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-minor-release This PR cannot be merged until the next minor release release-notes Should be mentioned in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implicit parameters should emit a warning at call site

5 participants