HaxeFoundation / HaxeFoundation/haxe

Typedef and Interface

Open
#11,026 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

Hej,

I don't know if it's intentional but I just realized that Haxe doesn't complain here : https://try.haxe.org/#729BD642
```haxe
typedef TFoo = {
a:Int,
b:Int
}

interface MyInterface {
public function get():TFoo;
}

class MyClass implements MyInterface {
public function new() {}

public function get() /*: TFoo*/ { // <--------------------
return {
a: 0,
b: 0,
c: 0
}
}
}

class Test {
static function main() {
var cl = new MyClass();
cl.get();
}
}
```
If the return type is uncommented it does complain as it should, but without, it should also complain at least that the return type isn't the same as in the interface right ?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.