-
Notifications
You must be signed in to change notification settings - Fork 17.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dev.go2go] go/types: don't modify Named.underlying when checking val…
…idity Addresses crash #20 of #39634. Added test, also for some of the other cases that don't crash anymore. Updates #39634. Change-Id: I999e376985a443ac435f64a7c249f891e7b7a6d7 Reviewed-on: https://go-review.googlesource.com/c/go/+/240901 Reviewed-by: Robert Griesemer <gri@golang.org>
- Loading branch information
Showing
3 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2020 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package p | ||
|
||
// crash 1 | ||
type nt(type )interface{g /* ERROR undeclared name */ } | ||
type ph(type e nt,g(d /* ERROR undeclared name */ ))s /* ERROR undeclared name */ | ||
func(*ph(e,e /* ERROR redeclared */ ))h(d /* ERROR undeclared name */ ) | ||
|
||
// crash 2 | ||
type Numeric2 interface{t /* ERROR not a type */ } | ||
func t(type T Numeric2)(s[]T){0 /* ERROR not a type */ (){s /* ERROR cannot index */ [0][0]}} | ||
|
||
// crash 4 | ||
type Numeric4 interface{t4 /* ERROR not a type */ } | ||
func t4(type T Numeric4)(s[]T){if( /* ERROR non-boolean */ 0){*s /* ERROR cannot indirect */ [0]}} | ||
|
||
// crash 7 | ||
type foo7 interface { bar() } | ||
type x7(type A) struct{ foo7 } | ||
func main7() { var _ foo7 = x7(int){} } | ||
|
||
// crash 8 | ||
type foo8(type A) interface { type A } | ||
func bar8(type A foo8(A))(a A) {} | ||
func main8() {} | ||
|
||
// crash 17 | ||
type Y17 interface{ c() } | ||
type Z17 interface { | ||
c() Y17 | ||
Y17 /* ERROR duplicate method */ | ||
} | ||
func F17(type T Z17)(T) | ||
|
||
// crash 20 | ||
type Z20 /* ERROR illegal cycle */ interface{ Z20 } | ||
func F20(type t Z20)() { F20(t /* ERROR invalid composite literal type */ {}) } | ||
|
||
// crash 21 | ||
type Z21 /* ERROR illegal cycle */ interface{ Z21 } | ||
func F21(type *T Z21)() { ( /* ERROR not used */ F21(Z21)) } |