-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Milestone
Description
Compiler version
3.2.2
Minimized example
class Ann(x: Any) extends annotation.Annotation
object Message:
implicit def toNoExplanation(str: String): Message @Ann(str) = ???
class Message
object report:
def error(x: Message): Unit = ???
def test =
report.error("a") // works
report.error("a".stripMargin) // error
Output
10 | report.error("a".stripMargin)
| ^^^^^^^^^^^^^^^
| Found: String
| Required: Message
|
Expectation
Should compile. The problem needs the following elements:
- the expected conversion needs to be a dependent method
- the argument needs to involve another implicit conversion in some way (in this case, the wrapper to
StringLike
which containsstripMargin
.
Metadata
Metadata
Assignees
Labels
Type
Projects
Relationships
Development
Select code repository
Activity
odersky commentedon Oct 19, 2022
I marked this as low-priority since it affects old style conversions only. New style conversions cannot be dependent, period.
odersky commentedon Oct 20, 2022
@smarter suggested that it's probably the fact that the argument is not a singleton that makes a difference, since in that case we have to skolemize.
SethTisue commentedon Oct 21, 2022
(Note that it does compile in Scala 2.13.10.)
Add regression tests
Add regression tests
Add regression tests (#20177)
Add regression tests