~mna/snow

snow/pkg/codegen/testdata/fn_assign_call_interface.snow -rw-r--r-- 322 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
interface I {
  fn foo()
}

struct S {
  let s: string

  fn foo() {
    println(s)
  }

  struct S2 {
    fn foo() {
      println("s2")
    }
  }
}

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

fn main() {
  var iface: I = S(s: "hello!")
  iface.foo()
  iface = S.S2()
  iface.foo()
}

#=hello!
#=s2