File: t657.scala

package info (click to toggle)
scala 2.11.12-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 62,828 kB
  • sloc: javascript: 28,808; java: 13,415; xml: 3,250; sh: 1,620; python: 756; makefile: 38; awk: 36; ansic: 6
file content (53 lines) | stat: -rw-r--r-- 1,447 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

import scala.language.{ implicitConversions }
abstract class BaseList {
  type Node <: NodeImpl;
  implicit def convertNode(ni : NodeImpl) = ni.asInstanceOf[Node];
  abstract class NodeImpl;
}
abstract class LinkedList extends BaseList {
  type Node <: NodeImpl;
  trait NodeImpl extends super.NodeImpl;
}
trait OffsetList extends LinkedList {
  type Node <: NodeImpl;
  trait NodeImpl extends super.NodeImpl;
}

trait PriorityTree extends BaseList {
  type Node <: NodeImpl;
  trait NodeImpl extends super.NodeImpl {
    def chop : Node = this;
  }
}

trait PrecedenceParser  extends LinkedList with PriorityTree {
  type Node <: NodeImpl;
  trait NodeImpl extends super[LinkedList].NodeImpl with super[PriorityTree].NodeImpl;
}

trait Matcher extends PrecedenceParser {
  type Node <: NodeImpl;
  trait NodeImpl extends super.NodeImpl;

  type Matchable <: Node with MatchableImpl;
  implicit def convertMatchable(m : MatchableImpl) = m.asInstanceOf[Matchable];
  trait MatchableImpl extends NodeImpl {
    override def chop : Node = {
      Console.println("passed"); super.chop;
    }
  }
}

class Test1 extends OffsetList with Matcher {
  type Node = NodeImpl;
  trait NodeImpl extends super[OffsetList].NodeImpl with super[Matcher].NodeImpl;
  class MatchableImpl extends super.MatchableImpl with NodeImpl;
  type Matchable = MatchableImpl;
}

object Test extends App {
  val test = new Test1;
  val m = new test.MatchableImpl;
  m.chop;
}