summaryrefslogtreecommitdiff
path: root/tests/examplefiles/carbon/declarations.carbon
blob: bcb9e05ba32dad387d491d2b3e3c7a211e13b566 (plain)
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
package ExplorerTest api;

choice MyOptionalElement(ZZ:! type, YY:! type) {
  None(YY),
  Element(ZZ)
}

abstract class C {
  var a: i32;
}

base class B {
  var value_b: i32;
}

interface Vector {
  fn Zero() -> Self;
  fn Add[self: Self](b: Self) -> Self;
  fn Scale[self: Self](v: i32) -> Self;
}

class Pal {
  private var x: i32;
  protected var y: i32;
  friend Buddy;
}

abstract class MyAbstractClass {
  protected fn Create() -> partial Self { }
}

constraint DrawVectorLegoFish {
  impl as VectorLegoFish;
  impl as Drawable;
}

impl JustX as X {}