fix 2 repl tests

pull/3130/head
Alexander Medvednikov 2019-12-18 04:59:42 +03:00
parent a46a2e4715
commit 7456d556e1
3 changed files with 12 additions and 14 deletions

View File

@ -293,14 +293,12 @@ fn (p &Parser) peek_token() Token {
} }
fn (p &Parser) log(s string) { fn (p &Parser) log(s string) {
123 // vfmt
/* /*
if !p.pref.is_verbose { if !p.pref.is_verbose {
return return
} }
println(s) println(s)
*/ */
} }
pub fn (p &Parser) save_state() ParserState { pub fn (p &Parser) save_state() ParserState {
@ -1965,7 +1963,7 @@ fn (p mut Parser) dot(str_typ_ string,method_ph int) string {
f := p.first_immutable_field f := p.first_immutable_field
p.error_with_token_index('cannot modify immutable field `$f.name` (type `$f.parent_fn`)\n' + 'declare the field with `mut:` p.error_with_token_index('cannot modify immutable field `$f.name` (type `$f.parent_fn`)\n' + 'declare the field with `mut:`
struct $f.parent_fn { struct $f.parent_fn {
mut: mut:
$f.name $f.typ $f.name $f.typ
} }
', fname_tidx) ', fname_tidx)
@ -1976,7 +1974,7 @@ struct $f.parent_fn {
// println(field.access_mod) // println(field.access_mod)
p.error_with_token_index('cannot refer to unexported field `$struct_field` (type `$typ.name`)\n' + 'declare the field with `pub:` p.error_with_token_index('cannot refer to unexported field `$struct_field` (type `$typ.name`)\n' + 'declare the field with `pub:`
struct $typ.name { struct $typ.name {
pub: pub:
$struct_field $field.typ $struct_field $field.typ
} }
', fname_tidx) ', fname_tidx)

View File

@ -35,44 +35,44 @@
cannot modify immutable field `len` (type `string`) cannot modify immutable field `len` (type `string`)
declare the field with `mut:` declare the field with `mut:`
struct string { struct string {
mut: mut:
len int len int
} }
cannot modify immutable field `a` (type `B`) cannot modify immutable field `a` (type `B`)
declare the field with `mut:` declare the field with `mut:`
struct B { struct B {
mut: mut:
a A a A
} }
cannot modify immutable field `a` (type `B`) cannot modify immutable field `a` (type `B`)
declare the field with `mut:` declare the field with `mut:`
struct B { struct B {
mut: mut:
a A a A
} }
cannot modify immutable field `a` (type `B`) cannot modify immutable field `a` (type `B`)
declare the field with `mut:` declare the field with `mut:`
struct B { struct B {
mut: mut:
a A a A
} }
cannot modify immutable field `a` (type `B`) cannot modify immutable field `a` (type `B`)
declare the field with `mut:` declare the field with `mut:`
struct B { struct B {
mut: mut:
a A a A
} }
`c2` is immutable `c2` is immutable
cannot modify immutable field `e` (type `F`) cannot modify immutable field `e` (type `F`)
declare the field with `mut:` declare the field with `mut:`
struct F { struct F {
mut: mut:
e []E e []E
} }
cannot modify immutable field `e` (type `F`) cannot modify immutable field `e` (type `F`)
declare the field with `mut:` declare the field with `mut:`
struct F { struct F {
mut: mut:
e []E e []E
} }
`e` is immutable (can't <<) `e` is immutable (can't <<)

View File

@ -12,19 +12,19 @@ println('BYE')
cannot modify immutable field `len` (type `string`) cannot modify immutable field `len` (type `string`)
declare the field with `mut:` declare the field with `mut:`
struct string { struct string {
mut: mut:
len int len int
} }
cannot modify immutable field `len` (type `array`) cannot modify immutable field `len` (type `array`)
declare the field with `mut:` declare the field with `mut:`
struct array { struct array {
mut: mut:
len int len int
} }
cannot modify immutable field `len` (type `array`) cannot modify immutable field `len` (type `array`)
declare the field with `mut:` declare the field with `mut:`
struct array { struct array {
mut: mut:
len int len int
} }
BYE BYE