Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Spec classes open #2143

Closed
wasowski opened this issue Jul 6, 2022 · 2 comments
Closed

Make Spec classes open #2143

wasowski opened this issue Jul 6, 2022 · 2 comments

Comments

@wasowski
Copy link

wasowski commented Jul 6, 2022

Starting Scala 3.1 (AFAIK) the compiler produces a warning (and under some settings an error) whenever extending a class that is not declared as open. Having studied https://docs.scala-lang.org/scala3/reference/other-new-features/open-classes.html, it seems to me that spec super classes are clear use case for open classes. Is there any reason why they are not declared open?

The warning message for the record, and for Google:

[warn] -- Feature Warning: [...] .scala:8:25
[warn] 8 |  org.scalatest.freespec.AnyFreeSpec,
[warn]   |  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[warn]   |Unless class AnyFreeSpec is declared 'open', its extension in a separate file should be enabled
[warn]   |by adding the import clause 'import scala.language.adhocExtensions'
[warn]   |or by setting the compiler option -language:adhocExtensions.
[warn]   |See the Scala docs for value scala.language.adhocExtensions for a discussion
[warn]   |why the feature should be explicitly enabled.
[warn] one warning found
@cheeseng
Copy link
Contributor

cheeseng commented Jul 7, 2022

@wasowski I agree, they are good candidates for Scala 3 open class. I have submitted the following PR here:

#2146

@wasowski
Copy link
Author

wasowski commented Oct 7, 2022

This appears to be merged (and I no longer get this error on 3.2.14).

@wasowski wasowski closed this as completed Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants