You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
inlinevalmsg:String="abc"traitE[T]
deff(using@annotation.implicitNotFound(msg) e: E[Int]):Unit= ()
@main defhello():Unit= f
Output
[error] -- [E172] TypeError:Main.scala:5:27
[error] 5|@main defhello():Unit= f
[error] |^
[error] |Nogiveninstance of typeE[Int] was found for parameter e of method f
Expectation
The error No given instance of type E[Int] was found for parameter e of method f is the default one that was supposed to be customized to abc. The reason this happens is the : String type annotation.
If you just do inline val msg = "abc" then it will work as expected:
I'm not surprised about this one, and I'm not sure if it should work. If not, it should at least be an error. (It should be it's own issue, can you open it please ?)
inline val msg: String = "abc" does not work (!)
The current code tries to infer the value for it's type. See:
belamenso
changed the title
Certain inline expressions inside implicitNotFound annotation disable it completely
Type-annotated inline expression inside implicitNotFound annotation disables it completely
Jan 14, 2025
Compiler version
3.6.2
Minimized code
Output
Expectation
The error
No given instance of type E[Int] was found for parameter e of method f
is the default one that was supposed to be customized toabc
. The reason this happens is the: String
type annotation.If you just do
inline val msg = "abc"
then it will work as expected:inline val msg = "abc"
worksinline val msg = "ab" + "c"
worksinline val msg: String = "abc"
does not work (!)inline val msg = "cba".reverse
does not workThe text was updated successfully, but these errors were encountered: