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
⚡ tail sandbox/{Test.java,sub.scala} && printf "\n" && javac -d /tmp sandbox/Test.java && scalac -d /tmp -cp /tmp sandbox/sub.scala
==> sandbox/Test.java <==
package p1;
public class Test {
protected Test() {}
}
==> sandbox/sub.scala <==
package p2
class C extends p1.Test()
Add a type parameter:
⚡ tail sandbox/{Test.java,sub.scala} && printf "\n" && javac -d /tmp sandbox/Test.java && scalac -d /tmp -cp /tmp sandbox/sub.scala
==> sandbox/Test.java <==
package p1;
public class Test<T> {
protected Test() {}
}
==> sandbox/sub.scala <==
package p2
class C extends p1.Test()
sandbox/sub.scala:3: error: constructor Test in class Test cannot be accessed in package p2
Access to protected constructor Test not permitted because
enclosing package p2 is not a subclass of
class Test in package p1 where target is defined
class C extends p1.Test()
^
one error found
The text was updated successfully, but these errors were encountered:
Maybe caused by a cycle (just a guess, I didn't look if that's actually the order of events in the typer): to infer the type argument in the supertype (p1.Test[Nothing]) the typer looks at the constructor call Test(), which triggers accessibility checking, which looks at the incomplete supertype.
Add a type parameter:
The text was updated successfully, but these errors were encountered: