Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/types, types2: missing error for incorrect main function #43308

Closed
griesemer opened this issue Dec 21, 2020 · 5 comments
Closed

go/types, types2: missing error for incorrect main function #43308

griesemer opened this issue Dec 21, 2020 · 5 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@griesemer
Copy link
Contributor

No error is reported for

package main
func main(int)

by go/types or types2. The compiler reports

main.go:2:6: func main must have no arguments and no return values

cc: @findleyr

@griesemer griesemer added the NeedsFix The path to resolution is known, but the work has not been done. label Dec 21, 2020
@griesemer griesemer added this to the Go1.17 milestone Dec 21, 2020
@gopherbot
Copy link

Change https://golang.org/cl/279532 mentions this issue: [dev.typeparams] all: merge dev.regabi into dev.typeparams

@gopherbot
Copy link

Change https://golang.org/cl/279552 mentions this issue: [dev.typeparams] cmd/compile/internal/types2: report error for invalid main function signature

@gopherbot
Copy link

Change https://golang.org/cl/279424 mentions this issue: go/types: report error for invalid main function signature

gopherbot pushed a commit that referenced this issue Dec 22, 2020
The files below had conflicts that required manual resolution.
The unresolved conflict in noder.go was just in the import
declaration (trivial). All the other conflicts are in tests
where the ERROR regex patterns changed to accomodate gccgo
error messages (incoming from dev.regabi), and to accomodate
types2 in dev.typeparams. They were resolved by accepting the
dev.regabi changes (so as not to lose them) and then by re-
applying whatever changes needed to make them pass with types2.
Finally, the new test mainsig.go was excluded from run.go when
using types2 due to issue #43308.

	src/cmd/compile/internal/gc/noder.go
	test/fixedbugs/bug13343.go
	test/fixedbugs/bug462.go
	test/fixedbugs/issue10975.go
	test/fixedbugs/issue11326.go
	test/fixedbugs/issue11361.go
	test/fixedbugs/issue11371.go
	test/fixedbugs/issue11674.go
	test/fixedbugs/issue13365.go
	test/fixedbugs/issue13471.go
	test/fixedbugs/issue14136.go
	test/fixedbugs/issue14321.go
	test/fixedbugs/issue14729.go
	test/fixedbugs/issue15898.go
	test/fixedbugs/issue16439.go
	test/fixedbugs/issue17588.go
	test/fixedbugs/issue19323.go
	test/fixedbugs/issue19482.go
	test/fixedbugs/issue19880.go
	test/fixedbugs/issue20185.go
	test/fixedbugs/issue20227.go
	test/fixedbugs/issue20415.go
	test/fixedbugs/issue20749.go
	test/fixedbugs/issue22794.go
	test/fixedbugs/issue22822.go
	test/fixedbugs/issue22921.go
	test/fixedbugs/issue23823.go
	test/fixedbugs/issue25727.go
	test/fixedbugs/issue26616.go
	test/fixedbugs/issue28079c.go
	test/fixedbugs/issue28450.go
	test/fixedbugs/issue30085.go
	test/fixedbugs/issue30087.go
	test/fixedbugs/issue35291.go
	test/fixedbugs/issue38745.go
	test/fixedbugs/issue41247.go
	test/fixedbugs/issue41440.go
	test/fixedbugs/issue41500.go
	test/fixedbugs/issue4215.go
	test/fixedbugs/issue6402.go
	test/fixedbugs/issue6772.go
	test/fixedbugs/issue7129.go
	test/fixedbugs/issue7150.go
	test/fixedbugs/issue7153.go
	test/fixedbugs/issue7310.go
	test/fixedbugs/issue8183.go
	test/fixedbugs/issue8385.go
	test/fixedbugs/issue8438.go
	test/fixedbugs/issue8440.go
	test/fixedbugs/issue8507.go
	test/fixedbugs/issue9370.go
	test/fixedbugs/issue9521.go

Change-Id: I26e6e326fde6e3fca5400711a253834d710ab7f4
gopherbot pushed a commit that referenced this issue Dec 22, 2020
…d main function signature

Updates #43308.

Change-Id: I2caff83f304c7e104edda76ac3623cce9fc94a8d
Reviewed-on: https://go-review.googlesource.com/c/go/+/279552
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
@gopherbot
Copy link

Change https://golang.org/cl/289714 mentions this issue: [dev.regabi] go/types: report error for invalid main function signature

gopherbot pushed a commit that referenced this issue Feb 4, 2021
This is a port of CL 279424, which didn't make it into master in time
for go1.16. Move it to dev.regabi so that it may be merged.

Notably, this port no longer removes the _InvalidInitSig error code,
instead opting to deprecate it. Now that error codes are 'locked in' for
go1.16, even if their API may not yet be exposed, we should follow the
practice of not changing their values. In the future, code generation
can make it easier to keep error code values constant.

For #43308

Change-Id: I5260b93fd063393d38d6458e45a67e7f9b7426ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/289714
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
@griesemer
Copy link
Contributor Author

In the meantime the fix in the branch was merged into the master branch. This is now fixed.

@golang golang locked and limited conversation to collaborators Apr 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants