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

derived with explicit term parameter creates confusing error at derives-site #15987

Closed
Sporarum opened this issue Sep 7, 2022 · 0 comments · Fixed by #21332
Closed

derived with explicit term parameter creates confusing error at derives-site #15987

Sporarum opened this issue Sep 7, 2022 · 0 comments · Fixed by #21332
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc area:typeclass-derivation itype:enhancement Spree Suitable for a future Spree
Milestone

Comments

@Sporarum
Copy link
Contributor

Sporarum commented Sep 7, 2022

Compiler version

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

scalaVersion := "3.2.0-RC1"
libraryDependencies += "org.scastie" %% "runtime-scala" % "1.0.0-SNAPSHOT"

addSbtPlugin("org.scastie" % "sbt-scastie" % "1.0.0-SNAPSHOT")

(3.2.0-RC1 is the latest version available on scastie)

Minimized code

trait Show[A]:
  extension(a: A) def show: String

object Show:
  def derived[A, B](x: B): Show[A] = ???

case object obj derives Show

https://scastie.scala-lang.org/Bw7NrMnbQdyKaakA8D5VQQ

Output

Found:    Playground.Show[A]
Required: String

where:    A is a type variable

Expectation

Something like:

derived instance Show[Person] failed to generate:
method `derived` from object Show takes explicit term parameters

Or:

Show cannot be used after `derives` as its companion object does not contain a method `derived` with signature:
  def derived[A, ...](using ...)...(using ...): Show[A]
Found:
  def derived[A, B](x: B): Show[A]
@Sporarum Sporarum added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Sep 7, 2022
@mbovel mbovel added itype:enhancement area:reporting Error reporting including formatting, implicit suggestions, etc area:typeclass-derivation Spree Suitable for a future Spree and removed itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Sep 12, 2022
@WojciechMazur WojciechMazur added this to the 3.6.0 milestone Oct 8, 2024
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 area:typeclass-derivation itype:enhancement Spree Suitable for a future Spree
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants