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
./bar.scala:7:21: can't find typerequired by method catsInstancesForIdCompat2_6_1 in objectcats.Invariant: compat.targetName; perhaps it is missing from the classpath.
The cause? annotations of the Invariant.catsInstancesForIdCompat2_6_1 method get forced, one of them being @cats.compat.targetName(...).
targetName is a type alias defined in cats.compat.compat$package but it seems that is never looked at because top level definition wrappers are not considered as part of the package scope in scala 2.
in the -Ydebug-tasty trace, we see that tasty reader tries to force the cats.compat.package package object which is of course empty.
#[6266, Invariant]: [8) <<< forcing annotations of symbol: `(#11713) method catsInstancesForIdCompat2_6_1`
#[6266, Invariant]: [8 0) <<< read within owner: `(#11713) method catsInstancesForIdCompat2_6_1` with modes `ReadAnnotation | ReadAnnotationCtor` at Addr(1118)
#[6266, Invariant]: [8 0 0) <<< reading annotation tree: `(#1738) class targetName` at Addr(1118)
#[6266, Invariant]: [8 0 0 0) <<< force symbol info: `(#7525) package class compat` in context `(#11713) method catsInstancesForIdCompat2_6_1` [space,deep]
#[6266, Invariant]: [8 0 0 0) >>> `(#7525) package class compat` was forced [space,deep]
[error] ./bar.scala:7:21: can't find type required by method catsInstancesForIdCompat2_6_1 in object cats.Invariant: compat.targetName; perhaps it is missing from the classpath.
[error] object Main extends App
[error] ^
Error compiling project (Scala 2.13.9, JVM)
Compilation failed
The text was updated successfully, but these errors were encountered:
this is more complicated to "fix" because there is also no support for targetName either - so fixing this resolution error will still have the incorrect method call at runtime - but if the method is not used directly from scala 2 then fine
@sjrd opinion is that top level definitions are too complex to put effort to support, in typelevel/cats#4304 I suggest to move cats.compat.targetName to a normal package object, then it is an open question of can we implement support for targetName annotation.
originally found in typelevel/cats#4304
Reproduction steps
Scala version: 2.13.9
Problem
this code makes the error
The cause? annotations of the
Invariant.catsInstancesForIdCompat2_6_1
method get forced, one of them being@cats.compat.targetName(...)
.targetName
is a type alias defined incats.compat.compat$package
but it seems that is never looked at because top level definition wrappers are not considered as part of the package scope in scala 2.in the
-Ydebug-tasty
trace, we see that tasty reader tries to force thecats.compat.package
package object which is of course empty.The text was updated successfully, but these errors were encountered: