summaryrefslogtreecommitdiff
path: root/tests/examplefiles/carbon/declarations.carbon
blob: 4f61d30750fd66023636cdf75796824d05f63afd (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
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 { }
}