diff options
author | Indrajith K L | 2022-12-03 17:00:20 +0530 |
---|---|---|
committer | Indrajith K L | 2022-12-03 17:00:20 +0530 |
commit | f5c4671bfbad96bf346bd7e9a21fc4317b4959df (patch) | |
tree | 2764fc62da58f2ba8da7ed341643fc359873142f /v_windows/v/vlib/v/checker/tests/modules | |
download | cli-tools-windows-master.tar.gz cli-tools-windows-master.tar.bz2 cli-tools-windows-master.zip |
Diffstat (limited to 'v_windows/v/vlib/v/checker/tests/modules')
6 files changed, 51 insertions, 0 deletions
diff --git a/v_windows/v/vlib/v/checker/tests/modules/module_alias_started_with_underscore.out b/v_windows/v/vlib/v/checker/tests/modules/module_alias_started_with_underscore.out new file mode 100644 index 0000000..a0cc315 --- /dev/null +++ b/v_windows/v/vlib/v/checker/tests/modules/module_alias_started_with_underscore.out @@ -0,0 +1,7 @@ +vlib/v/checker/tests/modules/module_alias_started_with_underscore/main.v:3:1: error: module alias `_` cannot start with `_` + 1 | module main + 2 | + 3 | import underscore as _ + | ~~~~~~~~~~~~~~~~~~~~~~ + 4 | + 5 | fn main() { diff --git a/v_windows/v/vlib/v/checker/tests/modules/module_alias_started_with_underscore/main.v b/v_windows/v/vlib/v/checker/tests/modules/module_alias_started_with_underscore/main.v new file mode 100644 index 0000000..39f80a1 --- /dev/null +++ b/v_windows/v/vlib/v/checker/tests/modules/module_alias_started_with_underscore/main.v @@ -0,0 +1,7 @@ +module main + +import underscore as _ + +fn main() { + _.foo() +} diff --git a/v_windows/v/vlib/v/checker/tests/modules/module_alias_started_with_underscore/underscore.v b/v_windows/v/vlib/v/checker/tests/modules/module_alias_started_with_underscore/underscore.v new file mode 100644 index 0000000..ec83c1c --- /dev/null +++ b/v_windows/v/vlib/v/checker/tests/modules/module_alias_started_with_underscore/underscore.v @@ -0,0 +1,5 @@ +module underscore + +pub fn foo() { + println('bar') +} diff --git a/v_windows/v/vlib/v/checker/tests/modules/overload_return_type.out b/v_windows/v/vlib/v/checker/tests/modules/overload_return_type.out new file mode 100644 index 0000000..dbdf6a5 --- /dev/null +++ b/v_windows/v/vlib/v/checker/tests/modules/overload_return_type.out @@ -0,0 +1,6 @@ +vlib/v/checker/tests/modules/overload_return_type/main.v:14:8: error: cannot assign to `two`: expected `point.Point`, not `int` + 12 | y: 1 + 13 | } + 14 | two = one + two + | ~~~~~~~~~ + 15 | } diff --git a/v_windows/v/vlib/v/checker/tests/modules/overload_return_type/main.v b/v_windows/v/vlib/v/checker/tests/modules/overload_return_type/main.v new file mode 100644 index 0000000..b682c49 --- /dev/null +++ b/v_windows/v/vlib/v/checker/tests/modules/overload_return_type/main.v @@ -0,0 +1,15 @@ +module main + +import point { Point } + +fn main() { + one := Point{ + x: 1 + y: 2 + } + mut two := Point{ + x: 5 + y: 1 + } + two = one + two +} diff --git a/v_windows/v/vlib/v/checker/tests/modules/overload_return_type/point.v b/v_windows/v/vlib/v/checker/tests/modules/overload_return_type/point.v new file mode 100644 index 0000000..a26932b --- /dev/null +++ b/v_windows/v/vlib/v/checker/tests/modules/overload_return_type/point.v @@ -0,0 +1,11 @@ +module point + +pub struct Point { +mut: + x int + y int +} + +pub fn (a Point) + (b Point) int { + return a.x + b.x +} |