From: Jérémie Astor Date: Thu, 1 Apr 2021 13:17:51 +0000 (+0200) Subject: :white_check_mark: Class extensions (add tests) X-Git-Tag: nightly~803 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=62e69c94afcafc02c24b8b9a39cbe04d2f7186be;p=gwion.git :white_check_mark: Class extensions (add tests) --- diff --git a/tests/extend/extend.gw b/tests/extend/extend.gw new file mode 100644 index 00000000..b917796c --- /dev/null +++ b/tests/extend/extend.gw @@ -0,0 +1,8 @@ +class C {} + +extends C { + fun void test() { <<< __func__ >>>; } +} + +const C c; +c.test(); diff --git a/tests/extend/extend_abstract.gw b/tests/extend/extend_abstract.gw new file mode 100644 index 00000000..7397ed86 --- /dev/null +++ b/tests/extend/extend_abstract.gw @@ -0,0 +1,4 @@ +#! [contains] abstract functions in extends +extends Event { + fun void test(); +} diff --git a/tests/extend/extend_final.gw b/tests/extend/extend_final.gw new file mode 100644 index 00000000..0b5dfdc3 --- /dev/null +++ b/tests/extend/extend_final.gw @@ -0,0 +1,6 @@ +#! [contains] extend final type +class final C {} + +extends C { + fun void test() {} +} diff --git a/tests/extend/extend_not_compound.gw b/tests/extend/extend_not_compound.gw new file mode 100644 index 00000000..8c492697 --- /dev/null +++ b/tests/extend/extend_not_compound.gw @@ -0,0 +1,4 @@ +#! [contains] only compound types can be extended +extends int { + fun void test(){} +} diff --git a/tests/extend/extend_tmpl.gw b/tests/extend/extend_tmpl.gw new file mode 100644 index 00000000..84e990a9 --- /dev/null +++ b/tests/extend/extend_tmpl.gw @@ -0,0 +1,8 @@ +class C:[A] {} + +extends C:[int] { + fun void test() { <<< __func__ >>>; } +} + +const C:[int] c; +c.test();