Skip to content

Commit f8693ad

Browse files
committed
checker: turn propagation warning into an error; sokol: make some structs public
1 parent a79c574 commit f8693ad

File tree

9 files changed

+20
-20
lines changed

9 files changed

+20
-20
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
- parser: fix `;` support for `module x;`
3535
- parser: fix fixed array of option values (`_ := [10]?int{}`) (#19392)
3636
- parser: fix assigning with in another module sumtypes 2 (#19415)
37+
- Support `;` statements, allowing for oneliners like `./v -e 'import os; println( os.ls(os.args[1])!.sorted(a > b) )' vlib/math` (#19345)
3738
- v.ast: improve Stmt.str(), showing more details about ast.Block, ast.DeferStmt, ast.ForInStmt, ast.GlobalDecl
3839

3940
#### Compiler internals
@@ -51,7 +52,6 @@
5152
- crypto.md5: change the Digest.write return type, from `?int` to `!int` (#19311)
5253
- v.help: use os.executable() instead of @VEXE as an anchor, so `v help` will work more robustly.
5354
- toml: fix custom `to_toml` for complex structs (#19338)
54-
- all: support `;` statements, allowing for oneliners like `./v -e 'import os; println( os.ls(os.args[1])!.sorted(a > b) )' vlib/math` (#19345)
5555
- vlib: add net.http.file, allowing for `v -e "import net.http.file; file.serve()"` (#19348)
5656
- vlib: remove functions and fields, deprecated before 2023-03-20
5757
- toml: fix toml encoding of complex types (#19408)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
## Stability, future changes, post 1.0 freeze
4545

4646
Despite being at an early development stage, the V language is relatively stable, and doesn't
47-
change often. But there will bechanges before 1.0.
47+
change often. But there will be changes before 1.0.
4848
Most changes in the syntax are handled via vfmt automatically.
4949

5050
The V core APIs (primarily the `os` module) will also have minor changes until

vlib/sokol/gfx/gfx_structs.c.v

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub mut:
7070

7171
pub type ColorState = C.sg_color_state
7272

73-
struct C.sg_pipeline_desc {
73+
pub struct C.sg_pipeline_desc {
7474
pub mut:
7575
_start_canary u32
7676
shader Shader
@@ -97,7 +97,7 @@ struct C.sg_pipeline_info {
9797

9898
pub type PipelineInfo = C.sg_pipeline_info
9999

100-
struct C.sg_pipeline {
100+
pub struct C.sg_pipeline {
101101
pub:
102102
id u32
103103
}
@@ -304,7 +304,7 @@ pub mut:
304304

305305
pub type Color = C.sg_color
306306

307-
struct C.sg_shader {
307+
pub struct C.sg_shader {
308308
pub:
309309
id u32
310310
}
@@ -332,7 +332,7 @@ struct C.sg_pass_info {
332332

333333
pub type PassInfo = C.sg_pass_info
334334

335-
struct C.sg_pass_action {
335+
pub struct C.sg_pass_action {
336336
pub mut:
337337
_start_canary u32
338338
colors [4]ColorAttachmentAction
@@ -385,7 +385,7 @@ struct C.sg_buffer_info {
385385

386386
pub type BufferInfo = C.sg_buffer_info
387387

388-
struct C.sg_buffer {
388+
pub struct C.sg_buffer {
389389
id u32
390390
}
391391

vlib/v/checker/checker.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1220,7 +1220,7 @@ fn (mut c Checker) check_or_expr(node ast.OrExpr, ret_type ast.Type, expr_return
12201220
}
12211221
if expr !is ast.Ident && !expr_return_type.has_flag(.option) {
12221222
if expr_return_type.has_flag(.result) {
1223-
c.warn('propagating a Result like an Option is deprecated, use `foo()!` instead of `foo()?`',
1223+
c.error('propagating a Result like an Option is deprecated, use `foo()!` instead of `foo()?`',
12241224
node.pos)
12251225
} else {
12261226
c.error('to propagate an Option, the call must also return an Option type',

vlib/v/checker/tests/propagate_option_with_result_err.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
vlib/v/checker/tests/propagate_option_with_result_err.vv:6:7: warning: propagating a Result like an Option is deprecated, use `foo()!` instead of `foo()?`
1+
vlib/v/checker/tests/propagate_option_with_result_err.vv:6:7: error: propagating a Result like an Option is deprecated, use `foo()!` instead of `foo()?`
22
4 |
33
5 | fn bar() ?string {
44
6 | foo()?

vlib/v/gen/c/testdata/alias_interface_method_call.vv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import io { Reader }
22

33
type Decoder = Reader
44

5-
fn (mut d Decoder) decode(len int) ?[]u8 {
5+
fn (mut d Decoder) decode(len int) ![]u8 {
66
mut buf := []u8{len: len}
7-
d.read(mut buf)?
7+
d.read(mut buf)!
88
return buf
99
}

vlib/v/gen/js/tests/option.v

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ fn main() {
44
try_propagation() or { println('captured: ${err}') }
55
}
66

7-
fn try_propagation() ? {
8-
try_numbers()?
7+
fn try_propagation() ! {
8+
try_numbers()!
99
}
1010

11-
fn try_numbers() ? {
11+
fn try_numbers() ! {
1212
for x in 1 .. 10 {
1313
y := error_if_even(x) or { x + 1 }
1414
println('${x} rounded to ${y}')
15-
error_if_prime(y)?
15+
error_if_prime(y)!
1616
}
1717
}
1818

vlib/v/tests/option_test.v

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ fn foo_str() ?string {
9999
return 'something'
100100
}
101101

102-
fn propagate_option(b bool) ?int {
103-
a := err_call(b)?
102+
fn propagate_option(b bool) !int {
103+
a := err_call(b)!
104104
return a
105105
}
106106

107-
fn propagate_different_type(b bool) ?bool {
108-
err_call(b)?
107+
fn propagate_different_type(b bool) !bool {
108+
err_call(b)!
109109
return true
110110
}
111111

vlib/v/tests/testdata/tests_returning_options_failing_test.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ fn test_example() ! {
1616
fn test_example_2() {
1717
assert true
1818
assert true
19-
example()?
19+
example()!
2020
}

0 commit comments

Comments
 (0)