- Notifications
You must be signed in to change notification settings - Fork 1.1k
Scaladoc: Fix snippets in documentation#12987
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
| valentry= (id, Seq(snippetImports, snippet).mkString("\n")) | ||
| snippetMap + entry | ||
| ) | ||
| } else snippetMap |
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.
Is there a reference documentation of all the changes implemented here? That would make the review easier.
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.
As for now there's no documentation. I'm gonna add it in this PR
bishabosha commented Jul 8, 2021
@pikinier20 just checking if you saw the comments here |
afd0eb7 to e1d3be4Comparedwijnand commented Jul 29, 2021
Looks like this needs a rebase now, btw. |
d531a14 to abaef17Comparepikinier20 commented Jul 29, 2021
I've created a PR to docs.scala-lang with documentation of snippet compiler |
abaef17 to 05fd457Comparepikinier20 commented Jul 30, 2021
This PR has been split into two. This PR should be merged after: #13217 |
Uh oh!
There was an error while loading. Please reload this page.
05fd457 to 1669943Compare
julienrf left a comment
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.
Overall, this looks good but the up to date content of the documentation is now hosted on the scala/docs.scala-lang repository.
If we want to leverage the snippet compiler, we need to also set up a process to publish the processed files to the docs.scala-lang repo.
| ```scala | ||
| //{ | ||
| importlanguage.experimental.fewerBraces | ||
| deftimes(i: Int)(fn: =>Unit) = (0 to i).foreach(x => fn) |
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.
Should we show both the import and the def, in the snippet, instead of putting them to the snippet context?
| // File EncryptedWriter.scala | ||
| packagep | ||
| traitEncrypter[T]: | ||
| defencrypt(t: T):T=??? |
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.
| def encrypt(t: T): T = ??? | |
| def encrypt(t: T): T |
| field points to an initialized object may not later point to an | ||
| object under initialization. As an example, the following code will be rejected: | ||
| ```scala |
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.
Should we add sc-fail then?
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.
Apparently, this code breaks only at runtime.
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.
Is this expected? cc @liufengyun
| extension [T](xs: Vec[T]) | ||
| @targetName("append") | ||
| def++=[T] (ys: Vec[T]):Vec[T] =... | ||
| def++= (ys: Vec[T]):Vec[T] =??? |
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.
👍
| ```scala | ||
| deff[X, Y](x: X)(usingtt: TypeTest[X, Y]):Option[Y] = x match | ||
| //{ | ||
| importscala.reflect.TypeTest |
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.
What about showing the import?
1669943 to aa46475Comparepikinier20 commented Aug 4, 2021
I close this PR because the documentation is migrated to docs.scala-lang and these changes don't make sense without using snippet compiler |
Fixed snippets in "Other new features" section