1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/v/fmt/tests/import_selective_input.vv

104 lines
1.8 KiB
V

import math { max,
min,
}
import cli { Command }
import math.complex { complex, Complex }
import os {
input, user_os, file_ext }
import mod {
Unused,
StructEmbed, StructField, StructRefField
StructMapFieldKey, StructMapFieldValue,
StructArrayFieldElem, StructFixedArrayFieldElem
StructMethodArg,
StructMethodArgGeneric,
StructMethodRet,
StructMethodRetGeneric,
InterfaceField,
InterfaceMethodArg,
InterfaceMethodRet,
FnArg,
FnArgVariadic
FnArgGeneric
FnArgTypeParam1
FnArgTypeParam2
FnRet,
FnRetGeneric
FnRetTypeParam1,
FnRetTypeParam2,
RightOfIs,
RightOfAs,
AliasTarget,
SumVariant1, SumVariant2,
FnAliasParam, FnAliasRet
Enum
}
type Alias = AliasTarget
type SumType = SumVariant1 | SumVariant2
type Fn = fn(FnAliasParam) FnAliasRet
struct Struct {
StructEmbed
v StructField
ref &StructRefField
map map[StructMapFieldKey]StructMapFieldValue
arr []StructArrayFieldElem
arr_fixed [2]StructFixedArrayFieldElem
}
fn (s Struct) method(v StructMethodArg) StructMethodRet {
return StructMethodRet{}
}
fn (s Struct) method_generic[T](v StructMethodArgGeneric[T]) StructMethodRetGeneric[T] {
return StructMethodRet[T]{}
}
interface Interface {
v InterfaceField
f(InterfaceMethodArg) InterfaceMethodRet
}
fn f(v FnArg, vv ...FnArgVariadic) FnRet {
if v is RightOfIs {}
_ = v as RightOfAs
println(Enum.val)
return FnRet{}
}
fn f2(v Generic<FnArgTypeParam1, FnArgTypeParam2>) Generic<FnRetTypeParam1, FnRetTypeParam2> {}
fn f_generic[T](v FnArgGeneric[T]) FnRetGeneric[T] {
return FnRetGeneric[T]{}
}
struct App {
command &Command
}
struct MyCommand {
Command
}
fn imaginary(im f64) Complex {
return complex(0, im)
}
fn main() {
println(max(0.1, 0.2))
println(min(0.1, 0.2))
println(user_os())
println(file_ext('main.v'))
println(imaginary(1))
}