~mna/snow

snow/pkg/semantic/testdata/fn_assign_struct_method_to_var.snow -rw-r--r-- 225 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
struct S {
  var x: int 

  fn get() -> int {
    return x
  }
  ref fn set(v: int) {
    x = v
  }
}

fn main() {
  var s: S
  var f1: ()->int = s.get
  var f2: (int)->void = s.set

  let s2: S
  f1 = s2.get
  f2 = s2.set
}