mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: as
type test
This commit is contained in:
parent
d9dd9679e7
commit
274ecb71fa
7
vlib/v/checker/tests/unknown_as_type.out
Normal file
7
vlib/v/checker/tests/unknown_as_type.out
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
x.v:7:9: error: unknown type `Stringg`
|
||||||
|
5 |
|
||||||
|
6 | fn foo(e Expr) {
|
||||||
|
7 | x := e as Stringg
|
||||||
|
| ~~
|
||||||
|
8 | println(x)
|
||||||
|
9 | }
|
13
vlib/v/checker/tests/unknown_as_type.vv
Normal file
13
vlib/v/checker/tests/unknown_as_type.vv
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
type Expr = Int | String
|
||||||
|
|
||||||
|
struct Int {}
|
||||||
|
struct String {}
|
||||||
|
|
||||||
|
fn foo(e Expr) {
|
||||||
|
x := e as Stringg
|
||||||
|
println(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user