~mna/snow

snow/pkg/codegen/testdata/struct_complex_generic.snow -rw-r--r-- 460 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
struct A [$T, $U] {
  struct B [$V] {
    var ffb: ($V) -> $V
  }

  var bb: B[$U]
  var ffa: ($T) -> $T
}

fn str(s: string) -> string {
  return s
}

fn integer(i: int) -> int {
  return i
}

fn main() {
  var a = A[int, string] (bb: A.B[string](ffb: str), ffa: integer)
  println(a.bb.ffb("ok"))
  printiln(a.ffa(3))
}

@extern(import: "fmt", symbol: "Println")
fn println(v: string)

@extern(import: "fmt", symbol: "Println")
fn printiln(v: int)

#=ok
#=3