Skip to content

Commit

Permalink
Merge pull request #388 from ckipp01/placeholder
Browse files Browse the repository at this point in the history
Filter out placeholders so they aren't bound in Dotty
  • Loading branch information
tgodzik committed Sep 18, 2020
2 parents d9ac112 + 7a99658 commit c6ffa48
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import scala.collection.mutable

def scala212 = "2.12.11"
def scala212 = "2.12.12"
def scala211 = "2.11.12"
def scala213 = "2.13.2"
def scala213 = "2.13.3"
def scala3 = List("0.26.0", "0.27.0-RC1")

def scalajs = "1.1.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ object Instrumenter {

object Binders {
private def fromPat(trees: List[Tree])(using ctx: Context) = {
trees.map {
case id: Ident =>
trees.collect {
case id: Ident if id.name.toString != "_" => // ignore placeholders
id.name.toString -> id.sourcePos
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class WorksheetProvider(settings: Settings) {
val compiler = ctx.compiler(instrumented)
val rendered =
MarkdownBuilder.buildDocument(compiler, reporter, sectionInputs, instrumented, input.path)

val decorations = for {
section <- rendered.sections.iterator
statement <- section.section.statements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,17 @@ class WorksheetSuite extends BaseSuite {
|""".stripMargin
)

checkDecorations(
"placeholder",
"""|def x = 1 -> 2
|val (a, _) = x
|""".stripMargin,
"""|def x = 1 -> 2
|<val (a, _) = x> // : Int = 1
|a: Int = 1
|""".stripMargin
)

def checkDiagnostics(
options: TestOptions,
original: String,
Expand Down

0 comments on commit c6ffa48

Please sign in to comment.