1
0
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:
Alexander Medvednikov 2020-06-19 11:27:20 +02:00
parent d9dd9679e7
commit 274ecb71fa
2 changed files with 20 additions and 0 deletions

View 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 | }

View 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() {
}