Skip to content

simplify syntax in enums.md #14556

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

Merged
merged 1 commit into from
Feb 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/_docs/reference/enums/enums.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@ even if they are imported (directly, or by renaming). For example:
```scala
import Planet.*
enum Planet(mass: Double, radius: Double):
private final val (MercuryMass @ _, MercuryRadius @ _) = (3.303e+23, 2.4397e6)
private final val (mercuryMass, mercuryRadius) = (3.303e+23, 2.4397e6)

case Mercury extends Planet(MercuryMass, MercuryRadius) // Not found
case Venus extends Planet(VenusMass, VenusRadius) // illegal reference
case Earth extends Planet(Planet.EarthMass, Planet.EarthRadius) // ok
case Mercury extends Planet(mercuryMass, mercuryRadius) // Not found
case Venus extends Planet(venusMass, venusRadius) // illegal reference
case Earth extends Planet(Planet.earthMass, Planet.earthRadius) // ok
object Planet:
private final val (VenusMass @ _, VenusRadius @ _) = (4.869e+24, 6.0518e6)
private final val (EarthMass @ _, EarthRadius @ _) = (5.976e+24, 6.37814e6)
private final val (venusMass, venusRadius) = (4.869e+24, 6.0518e6)
private final val (earthMass, earthRadius) = (5.976e+24, 6.37814e6)
end Planet
```
The fields referenced by `Mercury` are not visible, and the fields referenced by `Venus` may not
Expand Down