File: P_2.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 (21 lines) | stat: -rw-r--r-- 1,148 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
package P {                    // 'X' bound by package clause
  import Console._             // 'println' bound by wildcard import
  object A {
    println("L4: "+X)          // 'X' refers to 'P.X' here
    object B {
      import Q._               // 'X' bound by wildcard import
      println("L7: "+X)        // 'X' refers to 'Q.X' here
      import X._               // 'x' and 'y' bound by wildcard import
      println("L8: "+x)        // 'x' refers to 'Q.X.x' here
      object C {
        val x = 3              // 'x' bound by local definition
        println("L12: "+x);    // 'x' refers to constant '3' here
        { import Q.X._         // 'x' and 'y' bound by wildcard
          println("L14: "+x)   // reference to 'x' is ambiguous here
          import X.y           // 'y' bound by explicit import
          println("L16: "+y);  // 'y' refers to 'Q.X.y' here
          { val x = "abc"      // 'x' bound by local definition
            import P.X._       // 'x' and 'y' bound by wildcard
            println("L19: "+y) // reference to 'y' is ambiguous here
            println("L20: "+x) // 'x' refers to string ''abc'' here
}}}}}}