File: t5702-neg-bad-xbrace.scala

package info (click to toggle)
scala 2.11.12-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 62,924 kB
  • sloc: javascript: 28,808; java: 13,415; xml: 3,135; sh: 1,620; python: 756; makefile: 38; awk: 36; ansic: 6
file content (31 lines) | stat: -rw-r--r-- 797 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

object Test {
  def main(args: Array[String]) {
    /* PiS example, minus a brace
    val yearMade = 1965
    val old =
      <a>{ if (yearMade < 2000) <old>yearMade}</old>
           else xml.NodeSeq.Empty } </a>
    println(old)
    */

    // bad brace or paren after _*
    // actually, we know it's a bad paren...
    // we skip it because not in a context looking for rparen
    val xyear = <year>1965</year>
    val ancient =
      <b>{
        val when = xyear match {
          case <year>{_*)}</year> => y
          case _ => "2035"
        }
        <old>{when}</old>
      }</b>
    println(ancient)

    val xml = <top><a>apple</a><b>boy</b><c>child</c></top>
    // bad brace or paren after _*
    val <top>{a, z@_*)}</top> = xml
    println("A for "+ a +", ending with "+ z)
  }
}