Repository: goplus/gop
Pull request #1844 (2024-04-07 04:52:03)

ci(go.yml): update macOS version in Test job to "macos-latest"
This commit updates .github/workflows/go.yml by changing the macOS version in the testing matrix from "macos-11" to "macos-latest". The change is necessary due to the deprecation of the "macos-11" label, as mentioned in the GitHub Docs[^1]. According to the docs, the "macos-11" label will no longer be available after 2024-06-28.

[^1]: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories


Patch:
diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
index 234cf129..f3e4bc2b 100644
--- a/.github/workflows/go.yml
+++ b/.github/workflows/go.yml
@@ -21,7 +21,10 @@ jobs:
   Test:
     strategy:
       matrix:
-        os: [ubuntu-latest, windows-latest, macos-11]
+        os:
+        - ubuntu-latest
+        - windows-latest
+        - macos-latest
         go:
         - 1.18.x
         - 1.19.x
diff --git a/ast/ast_gop.go b/ast/ast_gop.go
index 8ccb2a1c..251716a4 100644
--- a/ast/ast_gop.go
+++ b/ast/ast_gop.go
@@ -118,7 +118,7 @@ func (*EnvExpr) exprNode() {}
 // A SliceLit node represents a slice literal.
 type SliceLit struct {
 	Lbrack     token.Pos // position of "["
-	Elts       []Expr    // list of slice elements; or nil
+	Elts       []Expr    // list of composite elements; or nil
 	Rbrack     token.Pos // position of "]"
 	Incomplete bool      // true if (source) expressions are missing in the Elts list
 }
@@ -137,28 +137,6 @@ func (*SliceLit) exprNode() {}
 
 // -----------------------------------------------------------------------------
 
-// A MatrixLit node represents a matrix literal.
-type MatrixLit struct {
-	Lbrack     token.Pos // position of "["
-	Elts       [][]Expr  // list of matrix elements
-	Rbrack     token.Pos // position of "]"
-	Incomplete bool      // true if (source) expressions are missing in the Elts list
-}
-
-// Pos - position of first character belonging to the node.
-func (p *MatrixLit) Pos() token.Pos {
-	return p.Lbrack
-}
-
-// End - position of first character immediately after the node.
-func (p *MatrixLit) End() token.Pos {
-	return p.Rbrack + 1
-}
-
-func (*MatrixLit) exprNode() {}
-
-// -----------------------------------------------------------------------------
-
 // ErrWrapExpr represents `expr!`, `expr?` or `expr?: defaultValue`.
 type ErrWrapExpr struct {
 	X       Expr
diff --git a/parser/_nofmt/matrix1/matrix.gop b/parser/_nofmt/matrix1/matrix.gop
deleted file mode 100644
index 3b393bd1..00000000
--- a/parser/_nofmt/matrix1/matrix.gop
+++ /dev/null
@@ -1,3 +0,0 @@
-echo [
-	1, 2, 3
-	4, 5, 6 ]
diff --git a/parser/_nofmt/matrix1/parser.expect b/parser/_nofmt/matrix1/parser.expect
deleted file mode 100644
index ac04e453..00000000
--- a/parser/_nofmt/matrix1/parser.expect
+++ /dev/null
@@ -1,43 +0,0 @@
-package main
-
-file matrix.gop
-noEntrypoint
-ast.FuncDecl:
-  Name:
-    ast.Ident:
-      Name: main
-  Type:
-    ast.FuncType:
-      Params:
-        ast.FieldList:
-  Body:
-    ast.BlockStmt:
-      List:
-        ast.ExprStmt:
-          X:
-            ast.CallExpr:
-              Fun:
-                ast.Ident:
-                  Name: echo
-              Args:
-                ast.MatrixLit:
-                  Elts:
-                    ast.BasicLit:
-                      Kind: INT
-                      Value: 1
-                    ast.BasicLit:
-                      Kind: INT
-                      Value: 2
-                    ast.BasicLit:
-                      Kind: INT
-                      Value: 3
-                    ast.BasicLit:
-                      Kind: INT
-                      Value: 4
-                    ast.BasicLit:
-                      Kind: INT
-                      Value: 5
-                    ast.BasicLit:
-                      Kind: INT
-                      Value: 6
-                  NElt: 2
diff --git a/parser/parser.go b/parser/parser.go
index 0df026d1..e6be3a42 100644
--- a/parser/parser.go
+++ b/parser/parser.go
@@ -824,7 +824,7 @@ func (p *parser) parseArrayTypeOrSliceLit(state int, slice ast.Expr) (expr ast.E
 		case stateArrayTypeOrSliceLit:
 			switch p.tok {
 			case token.COMMA: // [a, b, c, d ...]
-				sliceLit := p.parseSliceOrMatrixLit(lbrack, len)
+				sliceLit := p.parseSliceLit(lbrack, len)
 				p.exprLev--
 				return sliceLit, resultSliceLit
 			case token.FOR: // [expr for k, v <- container if cond]
@@ -887,35 +887,20 @@ func (p *parser) parseArrayTypeOrSliceLit(state int, slice ast.Expr) (expr ast.E
 	return &ast.ArrayType{Lbrack: lbrack, Len: len, Elt: elt}, resultArrayType
 }
 
-// [first, ...]
-// [first, a2, a2, ...; b1, b2, b3, ...]
-func (p *parser) parseSliceOrMatrixLit(lbrack token.Pos, first ast.Expr) ast.Expr {
-	var mat [][]ast.Expr
+func (p *parser) parseSliceLit(lbrack token.Pos, len ast.Expr) ast.Expr {
 	elts := make([]ast.Expr, 1, 8)
-	elts[0] = first
-	for {
-		switch p.tok {
-		case token.COMMA:
-		case token.SEMICOLON:
-			mat = append(mat, elts)
-			elts = make([]ast.Expr, 0, len(elts))
-		default:
-			goto done
-		}
+	elts[0] = len
+	for p.tok == token.COMMA {
 		p.next()
 		if p.tok != token.RBRACK {
 			elt := p.parseRHS()
 			elts = append(elts, elt)
 		}
 	}
-done:
 	rbrack := p.expect(token.RBRACK)
 
-	if mat != nil {
-		if len(elts) > 0 {
-			mat = append(mat, elts)
-		}
-		return &ast.MatrixLit{Lbrack: lbrack, Elts: mat, Rbrack: rbrack}
+	if debugParseOutput {
+		log.Printf("ast.SliceLit{Elts: %v}\n", elts)
 	}
 	return &ast.SliceLit{Lbrack: lbrack, Elts: elts, Rbrack: rbrack}
 }
diff --git a/printer/nodes.go b/printer/nodes.go
index e043c482..881aa6f3 100644
--- a/printer/nodes.go
+++ b/printer/nodes.go
@@ -968,24 +968,6 @@ func (p *printer) expr1(expr ast.Expr, prec1, depth int) {
 		p.print(indent, unindent, mode, x.Rbrace, token.RBRACE, mode)
 		p.level--
 
-	case *ast.MatrixLit:
-		p.level++
-		p.print(x.Lbrack, token.LBRACK, newline, indent)
-		var last = len(x.Elts) - 1
-		var incomplete bool
-		for i, elts := range x.Elts {
-			if i == last {
-				incomplete = x.Incomplete
-			}
-			p.exprList(elts[0].Pos(), elts, 1, 0, elts[len(elts)-1].End(), incomplete)
-			p.print(newline)
-		}
-		mode := noExtraLinebreak | noExtraBlank
-		// need the initial indent to print lone comments with
-		// the proper level of indentation
-		p.print(unindent, mode, x.Rbrack, token.RBRACK, mode)
-		p.level--
-
 	case *ast.Ellipsis:
 		p.print(token.ELLIPSIS)
 		if x.Elt != nil {
@@ -1052,7 +1034,7 @@ func (p *printer) expr1(expr ast.Expr, prec1, depth int) {
 			p.print(token.LBRACK)
 			p.expr0(x.Elt, depth+1)
 			p.print(blank)
-			p.listForPhrase(x.Fors)
+			p.listForPhrase(x.Lpos, x.Fors, depth, x.Rpos)
 			p.print(token.RBRACK)
 		default: // {...}
 			p.print(token.LBRACE)
@@ -1066,7 +1048,7 @@ func (p *printer) expr1(expr ast.Expr, prec1, depth int) {
 				}
 				p.print(blank)
 			}
-			p.listForPhrase(x.Fors)
+			p.listForPhrase(x.Lpos, x.Fors, depth, x.Rpos)
 			p.print(token.RBRACE)
 		}
 	case *ast.ErrWrapExpr:
@@ -1132,7 +1114,7 @@ func (p *printer) expr1(expr ast.Expr, prec1, depth int) {
 	}
 }
 
-func (p *printer) listForPhrase(list []*ast.ForPhrase) {
+func (p *printer) listForPhrase(prev0 token.Pos, list []*ast.ForPhrase, depth int, next0 token.Pos) {
 	for i, x := range list {
 		if i > 0 {
 			p.print(blank)
@@ -1924,7 +1906,6 @@ func (p *printer) funcBody(headerSize int, sep whiteSpace, b *ast.BlockStmt) {
 // by sep. Otherwise the block's opening "{" is printed on the current line, followed by
 // lines for the block's statements and its closing "}".
 func (p *printer) funcBodyUnnamed(headerSize int, sep whiteSpace, b *ast.BlockStmt) {
-	_, _ = headerSize, sep
 	if b == nil {
 		return
 	}


Test patch:
diff --git a/parser/_testdata/embedded1/embtype.gop b/parser/_testdata/embedded1/embtype.gop
deleted file mode 100644
index f34f7c63..00000000
--- a/parser/_testdata/embedded1/embtype.gop
+++ /dev/null
@@ -1,3 +0,0 @@
-type T struct {
-	abc.E
-}
diff --git a/parser/_testdata/embedded1/parser.expect b/parser/_testdata/embedded1/parser.expect
deleted file mode 100644
index 8786d354..00000000
--- a/parser/_testdata/embedded1/parser.expect
+++ /dev/null
@@ -1,24 +0,0 @@
-package main
-
-file embtype.gop
-ast.GenDecl:
-  Tok: type
-  Specs:
-    ast.TypeSpec:
-      Name:
-        ast.Ident:
-          Name: T
-      Type:
-        ast.StructType:
-          Fields:
-            ast.FieldList:
-              List:
-                ast.Field:
-                  Type:
-                    ast.SelectorExpr:
-                      X:
-                        ast.Ident:
-                          Name: abc
-                      Sel:
-                        ast.Ident:
-                          Name: E
diff --git a/parser/_testdata/matrix1/matrix.gop b/parser/_testdata/matrix1/matrix.gop
deleted file mode 100644
index b46adba7..00000000
--- a/parser/_testdata/matrix1/matrix.gop
+++ /dev/null
@@ -1,4 +0,0 @@
-echo [
-	1, 2, 3
-	4, 5, 6
-]
diff --git a/parser/_testdata/matrix1/parser.expect b/parser/_testdata/matrix1/parser.expect
deleted file mode 100644
index ac04e453..00000000
--- a/parser/_testdata/matrix1/parser.expect
+++ /dev/null
@@ -1,43 +0,0 @@
-package main
-
-file matrix.gop
-noEntrypoint
-ast.FuncDecl:
-  Name:
-    ast.Ident:
-      Name: main
-  Type:
-    ast.FuncType:
-      Params:
-        ast.FieldList:
-  Body:
-    ast.BlockStmt:
-      List:
-        ast.ExprStmt:
-          X:
-            ast.CallExpr:
-              Fun:
-                ast.Ident:
-                  Name: echo
-              Args:
-                ast.MatrixLit:
-                  Elts:
-                    ast.BasicLit:
-                      Kind: INT
-                      Value: 1
-                    ast.BasicLit:
-                      Kind: INT
-                      Value: 2
-                    ast.BasicLit:
-                      Kind: INT
-                      Value: 3
-                    ast.BasicLit:
-                      Kind: INT
-                      Value: 4
-                    ast.BasicLit:
-                      Kind: INT
-                      Value: 5
-                    ast.BasicLit:
-                      Kind: INT
-                      Value: 6
-                  NElt: 2
diff --git a/parser/parser_test.go b/parser/parser_test.go
index 46921b00..a7ecc5f6 100644
--- a/parser/parser_test.go
+++ b/parser/parser_test.go
@@ -20,6 +20,7 @@ import (
 	"io/fs"
 	"testing"
 
+	"github.com/goplus/gop/parser/parsertest"
 	"github.com/goplus/gop/token"
 	fsx "github.com/qiniu/x/http/fs"
 )
@@ -216,6 +217,272 @@ func TestErrInFunc(t *testing.T) {
 
 // -----------------------------------------------------------------------------
 
+var testStdCode = `package bar; import "io"
+	// comment
+	x := 0
+	if t := false; t {
+		x = 3
+	} else {
+		x = 5
+	}
+	println("x:", x)
+
+	// comment 1
+	// comment 2
+	x = 0
+	switch s := "Hello"; s {
+	default:
+		x = 7
+	case "world", "hi":
+		x = 5
+	case "xsw":
+		x = 3
+	}
+	println("x:", x)
+
+	c := make(chan bool, 100)
+	select {
+	case c <- true:
+	case v := <-c:
+	default:
+		panic("error")
+	}
+`
+
+func TestStd(t *testing.T) {
+	fset := token.NewFileSet()
+	pkgs, err := Parse(fset, "/foo/bar.gop", testStdCode, ParseComments)
+	if err != nil || len(pkgs) != 1 {
+		t.Fatal("Parse failed:", err, len(pkgs))
+	}
+	bar := pkgs["bar"]
+	parsertest.Expect(t, bar, `package bar
+
+file bar.gop
+noEntrypoint
+ast.GenDecl:
+  Tok: import
+  Specs:
+    ast.ImportSpec:
+      Path:
+        ast.BasicLit:
+          Kind: STRING
+          Value: "io"
+ast.FuncDecl:
+  Doc:
+    ast.CommentGroup:
+      List:
+        ast.Comment:
+          Text: // comment
+  Name:
+    ast.Ident:
+      Name: main
+  Type:
+    ast.FuncType:
+      Params:
+        ast.FieldList:
+  Body:
+    ast.BlockStmt:
+      List:
+        ast.AssignStmt:
+          Lhs:
+            ast.Ident:
+              Name: x
+          Tok: :=
+          Rhs:
+            ast.BasicLit:
+              Kind: INT
+              Value: 0
+        ast.IfStmt:
+          Init:
+            ast.AssignStmt:
+              Lhs:
+                ast.Ident:
+                  Name: t
+              Tok: :=
+              Rhs:
+                ast.Ident:
+                  Name: false
+          Cond:
+            ast.Ident:
+              Name: t
+          Body:
+            ast.BlockStmt:
+              List:
+                ast.AssignStmt:
+                  Lhs:
+                    ast.Ident:
+                      Name: x
+                  Tok: =
+                  Rhs:
+                    ast.BasicLit:
+                      Kind: INT
+                      Value: 3
+          Else:
+            ast.BlockStmt:
+              List:
+                ast.AssignStmt:
+                  Lhs:
+                    ast.Ident:
+                      Name: x
+                  Tok: =
+                  Rhs:
+                    ast.BasicLit:
+                      Kind: INT
+                      Value: 5
+        ast.ExprStmt:
+          X:
+            ast.CallExpr:
+              Fun:
+                ast.Ident:
+                  Name: println
+              Args:
+                ast.BasicLit:
+                  Kind: STRING
+                  Value: "x:"
+                ast.Ident:
+                  Name: x
+        ast.AssignStmt:
+          Lhs:
+            ast.Ident:
+              Name: x
+          Tok: =
+          Rhs:
+            ast.BasicLit:
+              Kind: INT
+              Value: 0
+        ast.SwitchStmt:
+          Init:
+            ast.AssignStmt:
+              Lhs:
+                ast.Ident:
+                  Name: s
+              Tok: :=
+              Rhs:
+                ast.BasicLit:
+                  Kind: STRING
+                  Value: "Hello"
+          Tag:
+            ast.Ident:
+              Name: s
+          Body:
+            ast.BlockStmt:
+              List:
+                ast.CaseClause:
+                  Body:
+                    ast.AssignStmt:
+                      Lhs:
+                        ast.Ident:
+                          Name: x
+                      Tok: =
+                      Rhs:
+                        ast.BasicLit:
+                          Kind: INT
+                          Value: 7
+                ast.CaseClause:
+                  List:
+                    ast.BasicLit:
+                      Kind: STRING
+                      Value: "world"
+                    ast.BasicLit:
+                      Kind: STRING
+                      Value: "hi"
+                  Body:
+                    ast.AssignStmt:
+                      Lhs:
+                        ast.Ident:
+                          Name: x
+                      Tok: =
+                      Rhs:
+                        ast.BasicLit:
+                          Kind: INT
+                          Value: 5
+                ast.CaseClause:
+                  List:
+                    ast.BasicLit:
+                      Kind: STRING
+                      Value: "xsw"
+                  Body:
+                    ast.AssignStmt:
+                      Lhs:
+                        ast.Ident:
+                          Name: x
+                      Tok: =
+                      Rhs:
+                        ast.BasicLit:
+                          Kind: INT
+                          Value: 3
+        ast.ExprStmt:
+          X:
+            ast.CallExpr:
+              Fun:
+                ast.Ident:
+                  Name: println
+              Args:
+                ast.BasicLit:
+                  Kind: STRING
+                  Value: "x:"
+                ast.Ident:
+                  Name: x
+        ast.AssignStmt:
+          Lhs:
+            ast.Ident:
+              Name: c
+          Tok: :=
+          Rhs:
+            ast.CallExpr:
+              Fun:
+                ast.Ident:
+                  Name: make
+              Args:
+                ast.ChanType:
+                  Value:
+                    ast.Ident:
+                      Name: bool
+                ast.BasicLit:
+                  Kind: INT
+                  Value: 100
+        ast.SelectStmt:
+          Body:
+            ast.BlockStmt:
+              List:
+                ast.CommClause:
+                  Comm:
+                    ast.SendStmt:
+                      Chan:
+                        ast.Ident:
+                          Name: c
+                      Value:
+                        ast.Ident:
+                          Name: true
+                ast.CommClause:
+                  Comm:
+                    ast.AssignStmt:
+                      Lhs:
+                        ast.Ident:
+                          Name: v
+                      Tok: :=
+                      Rhs:
+                        ast.UnaryExpr:
+                          Op: <-
+                          X:
+                            ast.Ident:
+                              Name: c
+                ast.CommClause:
+                  Body:
+                    ast.ExprStmt:
+                      X:
+                        ast.CallExpr:
+                          Fun:
+                            ast.Ident:
+                              Name: panic
+                          Args:
+                            ast.BasicLit:
+                              Kind: STRING
+                              Value: "error"
+`)
+}
+
 func TestClassErrCode(t *testing.T) {
 	testClassErrCode(t, `var (
 	A,B
@@ -287,30 +554,4 @@ func TestErrStringLiteral(t *testing.T) {
 `, `/foo/bar.gop:1:5: string literal not terminated`, ``)
 }
 
-func TestErrFieldDecl(t *testing.T) {
-	testErrCode(t, `
-type T struct {
-	*(Foo)
-}
-`, `/foo/bar.gop:3:3: cannot parenthesize embedded type`, ``)
-	testErrCode(t, `
-type T struct {
-	(Foo)
-}
-`, `/foo/bar.gop:3:2: cannot parenthesize embedded type`, ``)
-	testErrCode(t, `
-type T struct {
-	(*Foo)
-}
-`, `/foo/bar.gop:3:2: cannot parenthesize embedded type`, ``)
-}
-
-func TestParseFieldDecl(t *testing.T) {
-	var p parser
-	p.init(token.NewFileSet(), "/foo/bar.gop", []byte(`type T struct {
-}
-`), 0)
-	p.parseFieldDecl(nil)
-}
-
 // -----------------------------------------------------------------------------
diff --git a/parser/parserdir_test.go b/parser/parserdir_test.go
index 2277ec8d..0831a73b 100644
--- a/parser/parserdir_test.go
+++ b/parser/parserdir_test.go
@@ -41,272 +41,6 @@ func init() {
 	SetDebug(DbgFlagAll)
 }
 
-var testStdCode = `package bar; import "io"
-	// comment
-	x := 0
-	if t := false; t {
-		x = 3
-	} else {
-		x = 5
-	}
-	println("x:", x)
-
-	// comment 1
-	// comment 2
-	x = 0
-	switch s := "Hello"; s {
-	default:
-		x = 7
-	case "world", "hi":
-		x = 5
-	case "xsw":
-		x = 3
-	}
-	println("x:", x)
-
-	c := make(chan bool, 100)
-	select {
-	case c <- true:
-	case v := <-c:
-	default:
-		panic("error")
-	}
-`
-
-func TestStd(t *testing.T) {
-	fset := token.NewFileSet()
-	pkgs, err := Parse(fset, "/foo/bar.gop", testStdCode, ParseComments)
-	if err != nil || len(pkgs) != 1 {
-		t.Fatal("Parse failed:", err, len(pkgs))
-	}
-	bar := pkgs["bar"]
-	parsertest.Expect(t, bar, `package bar
-
-file bar.gop
-noEntrypoint
-ast.GenDecl:
-  Tok: import
-  Specs:
-    ast.ImportSpec:
-      Path:
-        ast.BasicLit:
-          Kind: STRING
-          Value: "io"
-ast.FuncDecl:
-  Doc:
-    ast.CommentGroup:
-      List:
-        ast.Comment:
-          Text: // comment
-  Name:
-    ast.Ident:
-      Name: main
-  Type:
-    ast.FuncType:
-      Params:
-        ast.FieldList:
-  Body:
-    ast.BlockStmt:
-      List:
-        ast.AssignStmt:
-          Lhs:
-            ast.Ident:
-              Name: x
-          Tok: :=
-          Rhs:
-            ast.BasicLit:
-              Kind: INT
-              Value: 0
-        ast.IfStmt:
-          Init:
-            ast.AssignStmt:
-              Lhs:
-                ast.Ident:
-                  Name: t
-              Tok: :=
-              Rhs:
-                ast.Ident:
-                  Name: false
-          Cond:
-            ast.Ident:
-              Name: t
-          Body:
-            ast.BlockStmt:
-              List:
-                ast.AssignStmt:
-                  Lhs:
-                    ast.Ident:
-                      Name: x
-                  Tok: =
-                  Rhs:
-                    ast.BasicLit:
-                      Kind: INT
-                      Value: 3
-          Else:
-            ast.BlockStmt:
-              List:
-                ast.AssignStmt:
-                  Lhs:
-                    ast.Ident:
-                      Name: x
-                  Tok: =
-                  Rhs:
-                    ast.BasicLit:
-                      Kind: INT
-                      Value: 5
-        ast.ExprStmt:
-          X:
-            ast.CallExpr:
-              Fun:
-                ast.Ident:
-                  Name: println
-              Args:
-                ast.BasicLit:
-                  Kind: STRING
-                  Value: "x:"
-                ast.Ident:
-                  Name: x
-        ast.AssignStmt:
-          Lhs:
-            ast.Ident:
-              Name: x
-          Tok: =
-          Rhs:
-            ast.BasicLit:
-              Kind: INT
-              Value: 0
-        ast.SwitchStmt:
-          Init:
-            ast.AssignStmt:
-              Lhs:
-                ast.Ident:
-                  Name: s
-              Tok: :=
-              Rhs:
-                ast.BasicLit:
-                  Kind: STRING
-                  Value: "Hello"
-          Tag:
-            ast.Ident:
-              Name: s
-          Body:
-            ast.BlockStmt:
-              List:
-                ast.CaseClause:
-                  Body:
-                    ast.AssignStmt:
-                      Lhs:
-                        ast.Ident:
-                          Name: x
-                      Tok: =
-                      Rhs:
-                        ast.BasicLit:
-                          Kind: INT
-                          Value: 7
-                ast.CaseClause:
-                  List:
-                    ast.BasicLit:
-                      Kind: STRING
-                      Value: "world"
-                    ast.BasicLit:
-                      Kind: STRING
-                      Value: "hi"
-                  Body:
-                    ast.AssignStmt:
-                      Lhs:
-                        ast.Ident:
-                          Name: x
-                      Tok: =
-                      Rhs:
-                        ast.BasicLit:
-                          Kind: INT
-                          Value: 5
-                ast.CaseClause:
-                  List:
-                    ast.BasicLit:
-                      Kind: STRING
-                      Value: "xsw"
-                  Body:
-                    ast.AssignStmt:
-                      Lhs:
-                        ast.Ident:
-                          Name: x
-                      Tok: =
-                      Rhs:
-                        ast.BasicLit:
-                          Kind: INT
-                          Value: 3
-        ast.ExprStmt:
-          X:
-            ast.CallExpr:
-              Fun:
-                ast.Ident:
-                  Name: println
-              Args:
-                ast.BasicLit:
-                  Kind: STRING
-                  Value: "x:"
-                ast.Ident:
-                  Name: x
-        ast.AssignStmt:
-          Lhs:
-            ast.Ident:
-              Name: c
-          Tok: :=
-          Rhs:
-            ast.CallExpr:
-              Fun:
-                ast.Ident:
-                  Name: make
-              Args:
-                ast.ChanType:
-                  Value:
-                    ast.Ident:
-                      Name: bool
-                ast.BasicLit:
-                  Kind: INT
-                  Value: 100
-        ast.SelectStmt:
-          Body:
-            ast.BlockStmt:
-              List:
-                ast.CommClause:
-                  Comm:
-                    ast.SendStmt:
-                      Chan:
-                        ast.Ident:
-                          Name: c
-                      Value:
-                        ast.Ident:
-                          Name: true
-                ast.CommClause:
-                  Comm:
-                    ast.AssignStmt:
-                      Lhs:
-                        ast.Ident:
-                          Name: v
-                      Tok: :=
-                      Rhs:
-                        ast.UnaryExpr:
-                          Op: <-
-                          X:
-                            ast.Ident:
-                              Name: c
-                ast.CommClause:
-                  Body:
-                    ast.ExprStmt:
-                      X:
-                        ast.CallExpr:
-                          Fun:
-                            ast.Ident:
-                              Name: panic
-                          Args:
-                            ast.BasicLit:
-                              Kind: STRING
-                              Value: "error"
-`)
-}
-
 func TestParseExprFrom(t *testing.T) {
 	fset := token.NewFileSet()
 	if _, err := ParseExprFrom(fset, "/foo/bar/not-exists", nil, 0); err == nil {
diff --git a/parser/parsertest/parsertest.go b/parser/parsertest/parsertest.go
index def8c133..081d233a 100644
--- a/parser/parsertest/parsertest.go
+++ b/parser/parsertest/parsertest.go
@@ -84,9 +84,6 @@ func FprintNode(w io.Writer, lead string, v interface{}, prefix, indent string)
 					FprintNode(w, fmt.Sprintf("%s%v:\n", prefix, sf.Name), sfv, prefix+indent, indent)
 				}
 			}
-			if m, ok := v.(*ast.MatrixLit); ok {
-				fmt.Fprintf(w, "%sNElt: %d\n", prefix, len(m.Elts))
-			}
 		} else if lit, ok := v.(*ast.StringLitEx); ok {
 			fmt.Fprintf(w, "%sExtra:\n", prefix)
 			prefix += indent