Skip to content

Commit 1b3385c

Browse files
committed
ci: disable old native runs; checker: const/import conflict check
1 parent e3faeb3 commit 1b3385c

7 files changed

Lines changed: 33 additions & 113 deletions

File tree

.github/workflows/linux_ci.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ jobs:
8080
run: v run ci/linux_ci.vsh test_leak_detector_tcc
8181
- name: Test leak detector not being active for normal compile
8282
run: v run ci/linux_ci.vsh test_leak_detector_not_active_tcc
83-
- name: native cross compilation to macos
84-
run: v run ci/linux_ci.vsh native_cross_compilation_to_macos
8583

8684
gcc-linux:
8785
runs-on: ubuntu-24.04
@@ -130,10 +128,6 @@ jobs:
130128
run: v run ci/linux_ci.vsh v_self_compilation_parallel_cc_gcc
131129
- name: Build modules
132130
run: v run ci/linux_ci.vsh build_modules_gcc
133-
- name: native machine code generation
134-
run: v run ci/linux_ci.vsh native_machine_code_generation_gcc
135-
- name: native cross compilation to macos
136-
run: v run ci/linux_ci.vsh native_cross_compilation_to_macos
137131
- name: compile vdoctor.v with -prod
138132
run: v run ci/linux_ci.vsh compile_vdoctor_prod_gcc
139133
- name: compile vup.v with -prod
@@ -181,7 +175,3 @@ jobs:
181175
run: v run ci/linux_ci.vsh build_examples_autofree_clang
182176
- name: Build modules
183177
run: v run ci/linux_ci.vsh build_modules_clang
184-
- name: native machine code generation
185-
run: v run ci/linux_ci.vsh native_machine_code_generation_clang
186-
- name: native cross compilation to macos
187-
run: v run ci/linux_ci.vsh native_cross_compilation_to_macos

.github/workflows/native_backend_ci.yml

Lines changed: 0 additions & 78 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# ignore sub-level untracked files and the v binary
22
*/**/*
3+
# unignore checker test files
4+
!vlib/v/checker/tests/*.vv
5+
!vlib/v/checker/tests/*.out
36
v
47
v.exe
58
v2

ci/linux_ci.vsh

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -395,28 +395,6 @@ fn build_modules_clang() {
395395
exec('v build-module vlib/os/cmdline')
396396
}
397397
398-
fn native_machine_code_generation_common() {
399-
exec('cd cmd/tools && v gen1m.v')
400-
exec('cd cmd/tools && ./gen1m > 1m.v')
401-
exec('cd cmd/tools && v -backend native -o 1m 1m.v')
402-
exec('cd cmd/tools && ./1m && ls -larS 1m*')
403-
exec('cd cmd/tools && rm -f ./1m ./1m.v')
404-
}
405-
406-
fn native_machine_code_generation_gcc() {
407-
native_machine_code_generation_common()
408-
}
409-
410-
fn native_machine_code_generation_clang() {
411-
native_machine_code_generation_common()
412-
}
413-
414-
fn native_cross_compilation_to_macos() {
415-
exec('v -os macos -experimental -b native -o hw.macos examples/hello_world.v')
416-
common.file_size_greater_than('hw.macos', 8000)
417-
exec('rm -f hw.macos')
418-
}
419-
420398
fn test_inline_assembly() {
421399
exec('v test vlib/v/slow_tests/assembly')
422400
}
@@ -483,9 +461,6 @@ const all_tasks = {
483461
'build_examples_clang': Task{build_examples_clang, 'Build examples (clang)'}
484462
'build_examples_autofree_clang': Task{build_examples_autofree_clang, 'Build examples with -autofree (clang)'}
485463
'build_modules_clang': Task{build_modules_clang, 'Build modules (clang)'}
486-
'native_machine_code_generation_clang': Task{native_machine_code_generation_clang, 'native machine code generation (clang)'}
487-
'native_machine_code_generation_gcc': Task{native_machine_code_generation_gcc, 'native machine code generation (gcc)'}
488-
'native_cross_compilation_to_macos': Task{native_cross_compilation_to_macos, 'native cross compilation to macos'}
489464
'test_inline_assembly': Task{test_inline_assembly, 'Test inline assembly'}
490465
}
491466

vlib/v/checker/checker.v

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3352,6 +3352,17 @@ fn (mut c Checker) const_decl(mut node ast.ConstDecl) {
33523352
}
33533353
c.error('duplicate of a module name `${field.name}`', name_pos)
33543354
}
3355+
for imp in c.file.imports {
3356+
imp_alias := if imp.alias.len > 0 { imp.alias } else { imp.mod.all_after_last('.') }
3357+
if const_name == imp_alias {
3358+
name_pos := token.Pos{
3359+
...field.pos
3360+
len: util.no_cur_mod(field.name, c.mod).len
3361+
}
3362+
c.error('const `${const_name}` conflicts with imported module `${imp.mod}`',
3363+
name_pos)
3364+
}
3365+
}
33553366
if const_name == '_' {
33563367
name_pos := token.Pos{
33573368
...field.pos
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
vlib/v/checker/tests/const_import_conflict_err.vv:1:8: warning: module 'strings' is imported but never used. Use `import strings as _`, to silence this warning, or just remove the unused import line
2+
1 | import strings
3+
| ~~~~~~~
4+
2 |
5+
3 | const strings = ['hello', 'world']
6+
vlib/v/checker/tests/const_import_conflict_err.vv:3:7: error: const `strings` conflicts with imported module `strings`
7+
1 | import strings
8+
2 |
9+
3 | const strings = ['hello', 'world']
10+
| ~~~~~~~
11+
4 |
12+
5 | fn main() {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import strings
2+
3+
const strings = ['hello', 'world']
4+
5+
fn main() {
6+
println(strings)
7+
}

0 commit comments

Comments
 (0)