Skip to content

go/parser: ParseExprFrom doesn't return errors if there were too many errors #34274

Closed
@griesemer

Description

@griesemer

Here's a simple test case:

package main

import "go/parser"
import "go/token"
import "fmt"

func main() {
	src := "s[::] +\ns[::] +\ns[::] +\ns[::] +\ns[::] +\ns[::] +\ns[::] +\ns[::] +\ns[::] +\ns[::] +\ns[::] +\ns[::]"
	fset := token.NewFileSet()
	_, err := parser.ParseExprFrom(fset, "", src, 0)
	if err != nil {
		fmt.Println(err)
	}
}

This should report:

1:3: 2nd index required in 3-index slice (and 10 more errors)

But it doesn't report an error at all.

See also discussion on https://go-review.googlesource.com/c/go/+/194638 .

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions