mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
53c64abdeb
* Move compiler/ under vlib/compiler/ . * Add a minimal compiler/main.v driver program. * Cleanup compiler/main.v . * Make most compiler tests pass again. * Apply the fix by @joe-conigliaro , so that the rest of the compiler tests are fixed too. * Thanks to @avitkauskas, now the vlib/vcompiler/tests/str_gen_test.v test does not need to be special cased anymore. * Reapply @joe-conigliaro fix for vgen.
31 lines
627 B
Plaintext
31 lines
627 B
Plaintext
mut s := 'hello world'
|
|
s.len = 0 // Error (field len immutable)
|
|
|
|
mut a := []string
|
|
a.len = 0 // Error (field len immutable)
|
|
|
|
mut ints := []int
|
|
ints.len = 0 // Error (field len immutable)
|
|
|
|
println('BYE')
|
|
===output===
|
|
.vrepl_temp.v:3:5: cannot modify immutable field `len` (type `string`)
|
|
declare the field with `mut:`
|
|
struct string {
|
|
mut:
|
|
len int
|
|
}
|
|
.vrepl_temp.v:4:5: cannot modify immutable field `len` (type `array`)
|
|
declare the field with `mut:`
|
|
struct array {
|
|
mut:
|
|
len int
|
|
}
|
|
.vrepl_temp.v:5:8: cannot modify immutable field `len` (type `array`)
|
|
declare the field with `mut:`
|
|
struct array {
|
|
mut:
|
|
len int
|
|
}
|
|
BYE
|