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

Fix supporting modifying sealed abstract classes in Scala 3 #80

Merged
merged 2 commits into from
Feb 14, 2022

Conversation

KacperFKorban
Copy link
Collaborator

This PR allows for sealed abstract classes to be modified in Scala 3.

All children of sealed abstract classes are known at compile-time, just like the children of sealed traits, so they should be supported as well. (They worked for Scala 2.13, there was just no test for it)

I tried adding this test for all Scala versions, but it seemed to fail for Scala 2.11 with:

[error] quicklens/quicklens/src/test/scala/com/softwaremill/quicklens/ModitySealedAbstractClass.scala:9:18: Could not find subclasses of sealed trait class Variance.
[error] You might need to ensure that it gets compiled before this invocation.
[error] See also: <https://issues.scala-lang.org/browse/SI-7046>.
[error]     invInt.modify(_.typ).setTo(Type("Long")) should be(invLong)
[error]                  ^
[error] knownDirectSubclasses of Variance observed before subclass Covariance registered
[error] knownDirectSubclasses of Variance observed before subclass Contravariance registered
[error] knownDirectSubclasses of Variance observed before subclass Invariance registered
[error] four errors found

@adamw adamw merged commit 598e730 into softwaremill:master Feb 14, 2022
@adamw
Copy link
Member

adamw commented Feb 14, 2022

Thanks! :)

@KacperFKorban KacperFKorban deleted the abstract-classes branch February 14, 2022 11:33
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

Successfully merging this pull request may close these issues.

2 participants