From 7456d556e1e02828544d5d363f44f34d4ed898b8 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Wed, 18 Dec 2019 04:59:42 +0300 Subject: [PATCH] fix 2 repl tests --- vlib/compiler/parser.v | 6 ++---- vlib/compiler/tests/repl/chained_fields.repl | 14 +++++++------- vlib/compiler/tests/repl/immutable_len_fields.repl | 6 +++--- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/vlib/compiler/parser.v b/vlib/compiler/parser.v index 5f3777578d..bc21b9fb90 100644 --- a/vlib/compiler/parser.v +++ b/vlib/compiler/parser.v @@ -293,14 +293,12 @@ fn (p &Parser) peek_token() Token { } fn (p &Parser) log(s string) { - 123 // vfmt /* if !p.pref.is_verbose { return } println(s) */ - } 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 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 { - mut: +mut: $f.name $f.typ } ', fname_tidx) @@ -1976,7 +1974,7 @@ struct $f.parent_fn { // 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:` struct $typ.name { - pub: +pub: $struct_field $field.typ } ', fname_tidx) diff --git a/vlib/compiler/tests/repl/chained_fields.repl b/vlib/compiler/tests/repl/chained_fields.repl index fcc433fb48..e62ead43e2 100644 --- a/vlib/compiler/tests/repl/chained_fields.repl +++ b/vlib/compiler/tests/repl/chained_fields.repl @@ -35,44 +35,44 @@ cannot modify immutable field `len` (type `string`) declare the field with `mut:` struct string { - mut: +mut: len int } cannot modify immutable field `a` (type `B`) declare the field with `mut:` struct B { - mut: +mut: a A } cannot modify immutable field `a` (type `B`) declare the field with `mut:` struct B { - mut: +mut: a A } cannot modify immutable field `a` (type `B`) declare the field with `mut:` struct B { - mut: +mut: a A } cannot modify immutable field `a` (type `B`) declare the field with `mut:` struct B { - mut: +mut: a A } `c2` is immutable cannot modify immutable field `e` (type `F`) declare the field with `mut:` struct F { - mut: +mut: e []E } cannot modify immutable field `e` (type `F`) declare the field with `mut:` struct F { - mut: +mut: e []E } `e` is immutable (can't <<) diff --git a/vlib/compiler/tests/repl/immutable_len_fields.repl b/vlib/compiler/tests/repl/immutable_len_fields.repl index 137b58f356..120eb7edcd 100644 --- a/vlib/compiler/tests/repl/immutable_len_fields.repl +++ b/vlib/compiler/tests/repl/immutable_len_fields.repl @@ -12,19 +12,19 @@ println('BYE') cannot modify immutable field `len` (type `string`) declare the field with `mut:` struct string { - mut: +mut: len int } cannot modify immutable field `len` (type `array`) declare the field with `mut:` struct array { - mut: +mut: len int } cannot modify immutable field `len` (type `array`) declare the field with `mut:` struct array { - mut: +mut: len int } BYE