Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Jan 22, 2025
1 parent 99f1cdf commit 2232a10
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 1 deletion.
21 changes: 21 additions & 0 deletions vlib/v/checker/tests/modules/private_symbol.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
vlib/v/checker/tests/modules/private_symbol/main.v:10:11: error: function `priv_sym.priv` is private
8 |
9 | fn main() {
10 | priv_sym.priv()
| ~~~~~~
11 | a := priv_sym.Foo(0)
12 | dump(a)
vlib/v/checker/tests/modules/private_symbol/main.v:11:16: error: alias `priv_sym.Foo` was declared as private to module `priv_sym`, so it can not be used inside module `main`
9 | fn main() {
10 | priv_sym.priv()
11 | a := priv_sym.Foo(0)
| ~~~~~~
12 | dump(a)
13 | b := priv_sym.BarFn(t)
vlib/v/checker/tests/modules/private_symbol/main.v:13:16: error: function type `priv_sym.BarFn` was declared as private to module `priv_sym`, so it can not be used inside module `main`
11 | a := priv_sym.Foo(0)
12 | dump(a)
13 | b := priv_sym.BarFn(t)
| ~~~~~~~~
14 | dump(b)
15 | c := priv_sym.PubFoo(0)
19 changes: 19 additions & 0 deletions vlib/v/checker/tests/modules/private_symbol/main.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module main

import priv_sym

fn t() int {
return 0
}

fn main() {
priv_sym.priv()
a := priv_sym.Foo(0)
dump(a)
b := priv_sym.BarFn(t)
dump(b)
c := priv_sym.PubFoo(0)
dump(c)
d := priv_sym.PubBarFn(t)
dump(d)
}
12 changes: 12 additions & 0 deletions vlib/v/checker/tests/modules/private_symbol/priv_sym.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// sub module
module priv_sym

type Foo = int
pub type PubFoo = int

type BarFn = fn () int

pub type PubBarFn = fn () int

fn priv() {
}
2 changes: 1 addition & 1 deletion vlib/x/templating/dtm/dynamic_template_manager.v
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import time
import regex

// These are all the types of dynamic values that the DTM allows to be returned in the context of a map
type DtmMultiTypeMap = f32 | f64 | i16 | i64 | i8 | int | string | u16 | u32 | u64 | u8
pub type DtmMultiTypeMap = f32 | f64 | i16 | i64 | i8 | int | string | u16 | u32 | u64 | u8

// type MiddlewareFn = fn (mut Context, string) bool

Expand Down

0 comments on commit 2232a10

Please sign in to comment.