~mna/snow

snow/pkg/semantic/testdata/struct_generic.snow -rw-r--r-- 417 bytes
424066c5Martin Angers doc: v0.0.5 1 year, 8 months ago
                                                                                
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
# implicit does not work
struct A {
  var x: $T
  let y: $U
  fn z() {
    let a: $U
    let b: $V

    fn inner() {
      let c: $W
    }
  }
}

# $V is unused
struct B [$T, $U, $V] {
  var x: $T
  fn f(v: int)  {
    var z: $U
  }
}

# $T is declared twice
struct C [$T, $U, $T] {
  var x: $T 
  let y: $U
}

# $V is not part of the explicit generic clause
struct D [$T, $U] {
  var v: $T
  let w: $U
  let x: $V
}