-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 typo in extension method example #8086
Fix typo in extension method example #8086
Conversation
eloots
commented
Jan 23, 2020
- Remove an extraneous ‘.’ in example code
- Remove an extraneous ‘.’ in example code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, and thank you for opening this PR! 🎉
All contributors have signed the CLA, thank you! ❤️
Have an awesome day! ☀️
Apparently, I hadn't signed the Scala CLA (as I wrongly assumed it was covered by another CLA I signed before). |
Just noticed that the same exists in https://dotty.epfl.ch/docs/reference/contextual/extension-methods-new.html According to this: #7914 the dot syntax is valid. It is also documented in DefSig ::= id [DefTypeParamClause] DefParamClauses
| ExtParamClause [nl] [‘.’] id DefParamClauses https://dotty.epfl.ch/docs/internals/syntax.html Should we swap the two pages? @smarter ? |
Two files exist with alternative version of the extension method doc: - docs/docs/reference/contextual/extension-methods.md - docs/docs/reference/contextual/extension-methods-new.md
@biboudis Indeed.
I presume the plan is to swap |
The dot-syntax is valid so we shouldn't remove it, so lets keep the parenthesis typo only and I merge Check: 9a0ddcd |
@biboudis No, one of those dots is a syntax error, because https://dotty.epfl.ch/docs/reference/contextual/extension-methods.html is meant to be about 0.21.0-RC1. $ dotr -version
Starting dotty REPL...
Dotty compiler version 0.21.0-RC1 -- Copyright 2002-2019, LAMP/EPFL
scala> case class Circle(x: Double, y: Double, radius: Double)
// defined case class Circle
scala> def (c: Circle).circumference: Double = c.radius * math.Pi * 2
1 |def (c: Circle).circumference: Double = c.radius * math.Pi * 2
| ^
| an identifier expected, but '.' found
1 |def (c: Circle).circumference: Double = c.radius * math.Pi * 2
| ^
| '=' expected, but eof found
scala> def (c: Circle) circumference: Double = c.radius * math.Pi * 2
def circumference(c: Circle): Double
scala> |
@eloots I took the liberty of editing the PR to show what it should be, IIUC. |
FWIW, the current docs workflow seems very challenging to deal with: Docs in master must document both the latest release and the current master. In many other projects, each version contains its own docs, and the website has a different folder for each release. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx both! @Blaisorblade
Couldn't agree more. It's quite confusing. I now look at the ref docs on the latest RC1 and the latest version on master (by pulling the most recent state on master & running |