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 typo in extension method example #8086

Merged
merged 4 commits into from
Jan 24, 2020

Conversation

eloots
Copy link
Contributor

@eloots eloots commented Jan 23, 2020

  • Remove an extraneous ‘.’ in example code

- Remove an extraneous ‘.’ in example code
Copy link
Member

@dottybot dottybot left a 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! ☀️

@eloots
Copy link
Contributor Author

eloots commented Jan 23, 2020

Apparently, I hadn't signed the Scala CLA (as I wrongly assumed it was covered by another CLA I signed before).
Fixed now.

@eloots eloots requested a review from dottybot January 23, 2020 18:33
@biboudis
Copy link
Contributor

biboudis commented Jan 23, 2020

Just noticed that the same exists in

https://dotty.epfl.ch/docs/reference/contextual/extension-methods-new.html

According to this:

#7914
which was superseded by
#7917

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
@eloots
Copy link
Contributor Author

eloots commented Jan 24, 2020

@biboudis Indeed.

docs/docs/reference/contextual/extension-methods-new.md contains the same typo in the first example, so I've added the correction to this file to this PR too.

I presume the plan is to swap docs/docs/reference/contextual/extension-methods.md for docs/docs/reference/contextual/extension-methods-new.md when 0.22.0-RC1 is released.

@biboudis
Copy link
Contributor

biboudis commented Jan 24, 2020

The dot-syntax is valid so we shouldn't remove it, so lets keep the parenthesis typo only and I merge

Check: 9a0ddcd

@Blaisorblade
Copy link
Contributor

Blaisorblade commented Jan 24, 2020

@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>

@Blaisorblade
Copy link
Contributor

Blaisorblade commented Jan 24, 2020

@eloots I took the liberty of editing the PR to show what it should be, IIUC.
EDIT: feel absolutely free to edit further/squash/...

@Blaisorblade
Copy link
Contributor

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.

@biboudis biboudis self-requested a review January 24, 2020 09:36
Copy link
Contributor

@biboudis biboudis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx both! @Blaisorblade

@biboudis biboudis merged commit 2b1c5de into scala:master Jan 24, 2020
@eloots
Copy link
Contributor Author

eloots commented Jan 24, 2020

@Blaisorblade

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.

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 genDocs)

@eloots eloots deleted the fix-typo-in-extension-method-example branch January 24, 2020 16:17
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.

4 participants