-
Notifications
You must be signed in to change notification settings - Fork 354
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
Unbound placeholder parameter error in worksheets with Dotty #2076
Comments
Thanks for finding this! The problem is most likely in mdoc, I am not super sure why this is, but it should be easily reproducible in the tests. |
So from looking at the evaluated document in Scala 2.x we get: EvaluatedDocument(Input.VirtualFile("placeholder.scala", "package repl
object MdocSession extends _root_.mdoc.internal.document.DocumentBuilder {
def app(): _root_.scala.Unit = {val _ = new App()}
class App {
$doc.startSection();
$doc.startStatement(0, 0, 0, 14);
def x = 1 -> 2
$doc.endStatement();
$doc.startStatement(1, 0, 1, 14);
val (a, _) = x; $doc.binder(a, 1, 5, 1, 6)
$doc.endStatement();
$doc.endSection();
}
} With Dotty it looks like so: EvaluatedDocument(Input.VirtualFile("placeholder.scala", "package repl
object MdocSession extends _root_.mdoc.internal.document.DocumentBuilder {
def app(): _root_.scala.Unit = {val _ = new App()}
class App {
$doc.startSection();
$doc.startStatement(0, 0, 0, 14);
def x = 1 -> 2
$doc.endStatement();
$doc.startStatement(1, 0, 1, 14);
val (a, _) = x
$doc.binder(a, 1, 5, 1, 6)
+ $doc.binder(_, 1, 8, 1, 9)
$doc.endStatement();
$doc.endSection();
}
} I'm going to make a wild guess and say that the |
I think it should be simple to add a check here: https://github.com/scalameta/mdoc/blob/f103ee4db62a1cebcaf5265a6d771bceb842b378/mdoc/src/main/scala-3/mdoc/internal/markdown/Instrumenter.scala#L147 |
Do you want to take a look at it or should I try to fix it? @ckipp01 |
I'm actually looking at it right now. So I'll ping you if I get stuck 😆 |
Describe the bug
Given the following code snippet in a worksheet with dotty...
...you'll see an error.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
This works fine in Scala 2 and is valid syntax afaik in Scala 3. This shouldn't give this error message.
Installation:
0.9.3+102-31fb9f1e-SNAPSHOT
Additional context
I'm still trying to figure out what exact placeholder syntax triggers this which doesn't some of the other types of placeholder syntaxes I've tried doesn't seem to be an issue like this one is.
cc @eloots
Search terms
placeholder syntax, dotty, worksheets
The text was updated successfully, but these errors were encountered: