Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: restore .v file endings for metadata/stubs #74

Merged
merged 4 commits into from
Mar 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/analyzer_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,13 @@ jobs:
run: v .github/workflows/version_test.vv

- name: Verify formatting
run: v fmt -verify -diff .
shell: bash
run: |
set +e
v fmt -c .
exit_code=$?
# Don't fail on internal errors.
if [[ $exit_code -ne 0 && $exit_code -ne 5 ]]; then
v fmt -diff .
exit 1
fi
22 changes: 11 additions & 11 deletions src/metadata/metadata.v
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ pub fn (e &EmbedFS) unpack_to(path string) ! {

pub fn embed_fs() EmbedFS {
mut files := []embed_file.EmbedFileData{}
files << $embed_file('stubs/arrays.vv', .zlib)
files << $embed_file('stubs/primitives.vv', .zlib)
files << $embed_file('stubs/vweb.vv', .zlib)
files << $embed_file('stubs/compile_time_constants.vv', .zlib)
files << $embed_file('stubs/compile_time_reflection.vv', .zlib)
files << $embed_file('stubs/builtin_compile_time.vv', .zlib)
files << $embed_file('stubs/channels.vv', .zlib)
files << $embed_file('stubs/arrays.v', .zlib)
files << $embed_file('stubs/primitives.v', .zlib)
files << $embed_file('stubs/vweb.v', .zlib)
files << $embed_file('stubs/compile_time_constants.v', .zlib)
files << $embed_file('stubs/compile_time_reflection.v', .zlib)
files << $embed_file('stubs/builtin_compile_time.v', .zlib)
files << $embed_file('stubs/channels.v', .zlib)
files << $embed_file('stubs/attributes/Deprecated.v', .zlib)
files << $embed_file('stubs/attributes/Table.v', .zlib)
files << $embed_file('stubs/attributes/Attribute.v', .zlib)
Expand All @@ -43,10 +43,10 @@ pub fn embed_fs() EmbedFS {
files << $embed_file('stubs/attributes/Noreturn.v', .zlib)
files << $embed_file('stubs/attributes/Manualfree.v', .zlib)
files << $embed_file('stubs/implicit.v', .zlib)
files << $embed_file('stubs/compile_time.vv', .zlib)
files << $embed_file('stubs/c_decl.vv', .zlib)
files << $embed_file('stubs/errors.vv', .zlib)
files << $embed_file('stubs/threads.vv', .zlib)
files << $embed_file('stubs/compile_time.v', .zlib)
files << $embed_file('stubs/c_decl.v', .zlib)
files << $embed_file('stubs/errors.v', .zlib)
files << $embed_file('stubs/threads.v', .zlib)

return EmbedFS{
files: files
Expand Down
2 changes: 0 additions & 2 deletions src/metadata/stubs/arrays.vv → src/metadata/stubs/arrays.v
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ pub:
// assert arr[2] == 0
// ```
len int

// cap field represent amount of memory space which has been reserved for elements,
// but not initialized or counted as elements
//
Expand All @@ -86,7 +85,6 @@ pub:
// arr_with_cap << 100 // no reallocation
// ```
cap int

// init field represent default initializer for each element.
//
// In `init` field, you can use special `index` variable to refer to the current index.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 1 addition & 14 deletions src/metadata/stubs/implicit.v
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,7 @@ module stubs
// Any is any type in code.
//
// It is needed to define all implicit methods of all types.
type Any = []Any
| bool
| f32
| f64
| i16
| i64
| i8
| int
| map[string]Any
| string
| u16
| u32
| u64
| u8
type Any = any

// str returns a string representation of the type.
//
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/server/language_server.v
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub mut:
// stubs_version incremented on each change in stubs
//
// See also `LanguageServer.setup_stubs()`
stubs_version int = 2
stubs_version int = 3
// initialization_options is a list of custom initialization options.
// Used to pass custom options in tests.
initialization_options []string
Expand Down
3 changes: 2 additions & 1 deletion src/tests/documentation.v
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import testing
fn documentation() testing.Tester {
mut t := testing.with_name('documentation')

t.documentation_test('rendered', 'documentation/rendered.vv')
t.documentation_test('rendered', 'documentation/rendered.v')
t.documentation_test('stubs', 'documentation/stubs.v')

return t
}
2 changes: 2 additions & 0 deletions src/tests/testdata/documentation/stubs.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
type Foo = v/*caret*/oidptr

7 changes: 7 additions & 0 deletions src/tests/testdata/documentation/stubs.v.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Module: **stubs**
```v
pub type voidptr = voidptr
```

voidptr is an untyped pointer. You can pass any other type of pointer value, to a function that accepts a voidptr.
Mostly used for [C interoperability](https://docs.vosca.dev/advanced-concepts/v-and-c.html).
40 changes: 20 additions & 20 deletions src/tests/types.v
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ import testing
fn types() testing.Tester {
mut t := testing.with_name('types')

t.type_test('literals', 'types/literals.vv')
t.type_test('parameters types', 'types/parameters.vv')
t.type_test('call expressions', 'types/call_expression.vv')
t.type_test('type initializer', 'types/type_initializer.vv')
t.type_test('for loops', 'types/for_loops.vv')
t.type_test('slice and index expression', 'types/slice_and_index_expression.vv')
t.type_test('function literal', 'types/function_literal.vv')
t.type_test('pointers', 'types/pointers.vv')
t.type_test('bool operators', 'types/bool_operators.vv')
t.type_test('unsafe expression', 'types/unsafe_expression.vv')
t.type_test('if expression', 'types/if_expression.vv')
t.type_test('match expression', 'types/match_expression.vv')
t.type_test('map init expression', 'types/map_init_expression.vv')
t.type_test('chan type', 'types/chan_type.vv')
t.type_test('struct fields', 'types/fields.vv')
t.type_test('receiver', 'types/receiver.vv')
t.type_test('json decode', 'types/json_decode.vv')
t.type_test('generics', 'types/generics.vv')
t.type_test('constants', 'types/constants.vv')
t.type_test('for loop', 'types/for_loop.vv')
t.type_test('literals', 'types/literals.v')
t.type_test('parameters types', 'types/parameters.v')
t.type_test('call expressions', 'types/call_expression.v')
t.type_test('type initializer', 'types/type_initializer.v')
t.type_test('for loops', 'types/for_loops.v')
t.type_test('slice and index expression', 'types/slice_and_index_expression.v')
t.type_test('function literal', 'types/function_literal.v')
t.type_test('pointers', 'types/pointers.v')
t.type_test('bool operators', 'types/bool_operators.v')
t.type_test('unsafe expression', 'types/unsafe_expression.v')
t.type_test('if expression', 'types/if_expression.v')
t.type_test('match expression', 'types/match_expression.v')
t.type_test('map init expression', 'types/map_init_expression.v')
t.type_test('chan type', 'types/chan_type.v')
t.type_test('struct fields', 'types/fields.v')
t.type_test('receiver', 'types/receiver.v')
t.type_test('json decode', 'types/json_decode.v')
t.type_test('generics', 'types/generics.v')
t.type_test('constants', 'types/constants.v')
t.type_test('for loop', 'types/for_loop.v')

return t
}
2 changes: 1 addition & 1 deletion tree_sitter_v/test/corpus/compile_time.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
================================================================================
Compile-time call expression
================================================================================
$embed_file('stubs/arrays.vv', .zlib)
$embed_file('stubs/arrays.v', .zlib)
--------------------------------------------------------------------------------

(source_file
Expand Down