-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
minimized code
Two files:
In this, the bodies of AsObject and AsPackage are exactly the same.
package blah
import scala.language.implicitConversions
import scala.quoted._
import scala.quoted.autolift._
import scala.tasty._
object AsObject {
final class LineNo(val lineNo: Int)
object LineNo {
def unsafe(i: Int): LineNo = new LineNo(i)
inline delegate for LineNo = ${impl}
private def impl given (r: Reflection): Expr[LineNo] = {
import r._
'{unsafe(${rootPosition.startLine})}
}
}
}
package AsPackage {
final class LineNo(val lineNo: Int)
object LineNo {
def unsafe(i: Int): LineNo = new LineNo(i)
inline delegate for LineNo = ${impl}
private def impl given (r: Reflection): Expr[LineNo] = {
import r._
'{unsafe(${rootPosition.startLine})}
}
}
}import blah._
def testO(): Unit = {
import AsObject.LineNo
the[LineNo]
}
def testP(): Unit = {
import AsPackage.LineNo
the[LineNo]
}error message
[error] -- Error: X2.scala:5:13
[error] 5 | the[LineNo]
[error] | ^
[error] |no implicit argument of type blah.AsObject.LineNo was found for parameter x of method the in object DottyPredef.
[error] |I found:
[error] |
[error] | {
[error] | <empty> :blah.AsObject.LineNo
[error] | }
[error] |
[error] |But method LineNo_instance in object LineNo does not match type blah.AsObject.LineNo.
[error] one error found
expectation
There shouldn't be any compilation errors. Putting LineNo in an object should be the same as putting it in a package.