text stringlengths 2 1.1M | id stringlengths 11 117 | metadata dict | __index_level_0__ int64 0 885 |
|---|---|---|---|
// run
// Copyright 2015 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.
// issue 10253: cmd/gc: incorrect escape analysis of closures
// Partial call x.foo was not promoted to heap.
package main
func main() {
c := make(ch... | go/test/fixedbugs/issue10353.go/0 | {
"file_path": "go/test/fixedbugs/issue10353.go",
"repo_id": "go",
"token_count": 323
} | 500 |
// rundir
// Copyright 2015 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.
// Issue 11053: Compiler does not run escape analysis on an inlined
// generated method wrapper.
package ignored
| go/test/fixedbugs/issue11053.go/0 | {
"file_path": "go/test/fixedbugs/issue11053.go",
"repo_id": "go",
"token_count": 74
} | 501 |
// errorcheck -lang=go1.17
// Copyright 2015 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.
// Test that incorrect expressions involving wrong anonymous interface
// do not generate panics in Type Stringer.
// Does not compi... | go/test/fixedbugs/issue11614.go/0 | {
"file_path": "go/test/fixedbugs/issue11614.go",
"repo_id": "go",
"token_count": 206
} | 502 |
// run
// Copyright 2015 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.
// A generated method with a return value large enough to be
// initialized by duffzero is not a leaf method, which violated
// assumptions made by cmd/... | go/test/fixedbugs/issue12108.go/0 | {
"file_path": "go/test/fixedbugs/issue12108.go",
"repo_id": "go",
"token_count": 208
} | 503 |
// run
// Copyright 2014 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 main
var a = 1
func main() {
defer func() {
recover()
if a != 2 {
println("BUG a =", a)
}
}()
a = 2
b := a - a
c := 4
a = c / b... | go/test/fixedbugs/issue1304.go/0 | {
"file_path": "go/test/fixedbugs/issue1304.go",
"repo_id": "go",
"token_count": 132
} | 504 |
// errorcheck
// Copyright 2015 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.
// issue 13365: confusing error message (array vs slice)
package main
var t struct{}
func main() {
_ = []int{-1: 0} // ERROR "index must b... | go/test/fixedbugs/issue13365.go/0 | {
"file_path": "go/test/fixedbugs/issue13365.go",
"repo_id": "go",
"token_count": 340
} | 505 |
// errorcheck
// Copyright 2016 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.
// Literals that happen to resolve to named constants
// may be used as label names (see issue 13684). Make
// sure that other literals don't cra... | go/test/fixedbugs/issue14006.go/0 | {
"file_path": "go/test/fixedbugs/issue14006.go",
"repo_id": "go",
"token_count": 480
} | 506 |
// run
//go:build !nacl && !js && !wasip1 && !android && gc
// Copyright 2016 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 main
import (
"bytes"
"log"
"os/exec"
"strings"
)
func main() {
checkLinkOutput("",... | go/test/fixedbugs/issue14636.go/0 | {
"file_path": "go/test/fixedbugs/issue14636.go",
"repo_id": "go",
"token_count": 438
} | 507 |
// compile
// Copyright 2016 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 x
type T struct {
i int
e interface{}
}
func (t *T) F() bool {
if t.i != 0 {
return false
}
_, ok := t.e.(string)
return ok
}
va... | go/test/fixedbugs/issue15084.go/0 | {
"file_path": "go/test/fixedbugs/issue15084.go",
"repo_id": "go",
"token_count": 164
} | 508 |
// errorcheck
// Copyright 2016 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
func f(e interface{}) {
switch e.(type) {
case nil, nil: // ERROR "multiple nil cases in type switch|duplicate type in switch|duplic... | go/test/fixedbugs/issue15898.go/0 | {
"file_path": "go/test/fixedbugs/issue15898.go",
"repo_id": "go",
"token_count": 152
} | 509 |
package a
type X string
func NewX() X {
return ""
}
| go/test/fixedbugs/issue16133.dir/a1.go/0 | {
"file_path": "go/test/fixedbugs/issue16133.dir/a1.go",
"repo_id": "go",
"token_count": 22
} | 510 |
// run
// Copyright 2017 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 main
import (
"fmt"
"os"
)
var (
e interface{}
s = struct{ a *int }{}
b = e == s
)
func test(obj interface{}) {
if obj != struct{ a *st... | go/test/fixedbugs/issue18661.go/0 | {
"file_path": "go/test/fixedbugs/issue18661.go",
"repo_id": "go",
"token_count": 226
} | 511 |
// Copyright 2017 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 main
import (
"reflect"
fake "./a" // 2nd package with name "reflect"
)
type T struct {
_ fake.Type
}
func (T) f() ... | go/test/fixedbugs/issue19028.dir/main.go/0 | {
"file_path": "go/test/fixedbugs/issue19028.dir/main.go",
"repo_id": "go",
"token_count": 250
} | 512 |
// run
// Copyright 2017 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 main
import (
"fmt"
)
type PI struct {
Enabled bool
}
type SI struct {
M map[string]*PI
}
//go:noinline
func (s *SI) test(name string) (*... | go/test/fixedbugs/issue19275.go/0 | {
"file_path": "go/test/fixedbugs/issue19275.go",
"repo_id": "go",
"token_count": 500
} | 513 |
// compile
// Copyright 2017 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.
// Check that we don't crash due to "lost track of variable in
// liveness" errors against unused variables.
package p
import "strings"
// Minimi... | go/test/fixedbugs/issue19632.go/0 | {
"file_path": "go/test/fixedbugs/issue19632.go",
"repo_id": "go",
"token_count": 189
} | 514 |
// rundir
// Copyright 2017 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.
// Issue 19764: test that the linker's trampoline insertion
// pass is happy with direct calls to interface wrappers that
// may be defined in multip... | go/test/fixedbugs/issue19764.go/0 | {
"file_path": "go/test/fixedbugs/issue19764.go",
"repo_id": "go",
"token_count": 88
} | 515 |
// errorcheck
// Copyright 2017 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.
// Issue 20185: type switching on untyped values (e.g. nil or consts)
// caused an internal compiler error.
package p
func F() {
switch t := n... | go/test/fixedbugs/issue20185.go/0 | {
"file_path": "go/test/fixedbugs/issue20185.go",
"repo_id": "go",
"token_count": 183
} | 516 |
// compile
// Copyright 2017 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.
// Gccgo crashed compiling this code due to failing to finalize
// interfaces in the right order.
package p
type s1 struct {
f m
I
}
type m int... | go/test/fixedbugs/issue21253.go/0 | {
"file_path": "go/test/fixedbugs/issue21253.go",
"repo_id": "go",
"token_count": 130
} | 517 |
// errorcheck
// Copyright 2019 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.
// selector expression resolves incorrectly for defined
// pointer types.
package main
type E struct{ f int }
type T struct{ E }
func (*T) f()... | go/test/fixedbugs/issue21934.go/0 | {
"file_path": "go/test/fixedbugs/issue21934.go",
"repo_id": "go",
"token_count": 171
} | 518 |
// errorcheck
// Copyright 2018 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
func _(x int) {
_ = ~x // unary ~ permitted but the type-checker will complain
}
func _(x int) {
_ = x ~ x // ERROR "unexpected ... | go/test/fixedbugs/issue23587.go/0 | {
"file_path": "go/test/fixedbugs/issue23587.go",
"repo_id": "go",
"token_count": 111
} | 519 |
// errorcheck
// Copyright 2018 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
type intAlias = int
func f() {
switch interface{}(nil) {
case uint8(0):
case byte(0): // ERROR "duplicate case"
case int32(0):
c... | go/test/fixedbugs/issue24159.go/0 | {
"file_path": "go/test/fixedbugs/issue24159.go",
"repo_id": "go",
"token_count": 146
} | 520 |
// run
// Copyright 2018 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.
// Make sure we don't prove that the bounds check failure branch is unreachable.
package main
//go:noinline
func f(a []int) {
_ = a[len(a)-1]
}
func... | go/test/fixedbugs/issue27289.go/0 | {
"file_path": "go/test/fixedbugs/issue27289.go",
"repo_id": "go",
"token_count": 152
} | 521 |
// run
// Copyright 2018 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.
// Issue 27961: some optimizations generate OffPtr with wrong
// types, which causes invalid bytecode on Wasm.
package main
import "math"
type Vec2 [... | go/test/fixedbugs/issue27961.go/0 | {
"file_path": "go/test/fixedbugs/issue27961.go",
"repo_id": "go",
"token_count": 235
} | 522 |
// run -gcflags=-d=softfloat
// Copyright 2018 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 main
import (
"fmt"
)
// When using soft-float, OMUL might be rewritten to function
// call so we should ensure it was ... | go/test/fixedbugs/issue28688.go/0 | {
"file_path": "go/test/fixedbugs/issue28688.go",
"repo_id": "go",
"token_count": 218
} | 523 |
// run
// Copyright 2018 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.
// Verify that we don't consider a Go'd function's
// arguments as pointers when they aren't.
package main
import (
"unsafe"
)
var badPtr uintptr
v... | go/test/fixedbugs/issue29362b.go/0 | {
"file_path": "go/test/fixedbugs/issue29362b.go",
"repo_id": "go",
"token_count": 482
} | 524 |
// errorcheck
// Copyright 2019 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.
// Make sure we're compiling "_" functions at least enough
// to get to an error which is generated during walk.
package main
func _() {
x := ... | go/test/fixedbugs/issue29870b.go/0 | {
"file_path": "go/test/fixedbugs/issue29870b.go",
"repo_id": "go",
"token_count": 98
} | 525 |
// run
// Copyright 2019 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 main
import "fmt"
//go:noinline
func ident(s string) string { return s }
func returnSecond(x bool, s string) string { return s }
func identW... | go/test/fixedbugs/issue30566a.go/0 | {
"file_path": "go/test/fixedbugs/issue30566a.go",
"repo_id": "go",
"token_count": 175
} | 526 |
// run
// Copyright 2019 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 main
type T struct {
s [1]string
pad [16]uintptr
}
//go:noinline
func f(t *int, p *int) []T {
var res []T
for {
var e *T
res = appen... | go/test/fixedbugs/issue32288.go/0 | {
"file_path": "go/test/fixedbugs/issue32288.go",
"repo_id": "go",
"token_count": 316
} | 527 |
// errorcheck
// Copyright 2019 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.
// Verify that we don't get spurious follow-on errors
// after a missing expression. Specifically, the parser
// shouldn't skip over closing pare... | go/test/fixedbugs/issue33386.go/0 | {
"file_path": "go/test/fixedbugs/issue33386.go",
"repo_id": "go",
"token_count": 315
} | 528 |
// run -race
//go:build cgo && linux && amd64
// 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 main
import (
"fmt"
"testing"
"unsafe"
)
var buf [2]byte
var x unsafe.Pointer = unsafe.Pointer(&buf... | go/test/fixedbugs/issue36516.go/0 | {
"file_path": "go/test/fixedbugs/issue36516.go",
"repo_id": "go",
"token_count": 208
} | 529 |
// errorcheck
// 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.
// cmd/compile erroneously rejected conversions of constant values
// between int/float and complex types.
package p
const (
_ = int(complex64... | go/test/fixedbugs/issue38117.go/0 | {
"file_path": "go/test/fixedbugs/issue38117.go",
"repo_id": "go",
"token_count": 129
} | 530 |
// run
// 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 main
func main() {
ff := []func(){lt_f1, lt_f2, lt_f3, lt_f4, lt_f5, lt_f6, lt_f7, lt_f8, lt_f9,
gt_f1, gt_f2, gt_f3, le_f1, le_f2, le_f3, g... | go/test/fixedbugs/issue39505b.go/0 | {
"file_path": "go/test/fixedbugs/issue39505b.go",
"repo_id": "go",
"token_count": 1382
} | 531 |
// errorcheck -0 -m
//go:build !goexperiment.newinliner
// Copyright 2013 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.
// Check go:noescape annotations.
package p
// The noescape comment only applies to the next func,
/... | go/test/fixedbugs/issue4099.go/0 | {
"file_path": "go/test/fixedbugs/issue4099.go",
"repo_id": "go",
"token_count": 184
} | 532 |
// errorcheck
// Copyright 2013 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.
// issue 4264: reject int division by const 0
package main
func main() {
var x int
var y float64
var z complex128
println(x/0) // ERROR "d... | go/test/fixedbugs/issue4264.go/0 | {
"file_path": "go/test/fixedbugs/issue4264.go",
"repo_id": "go",
"token_count": 117
} | 533 |
// 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 b
import "./a"
var Here = a.New()
var Dir = Here.Dir
type T = struct {
a.Here
a.I
}
var X T
// Test exporting the type of method values for anony... | go/test/fixedbugs/issue43479.dir/b.go/0 | {
"file_path": "go/test/fixedbugs/issue43479.dir/b.go",
"repo_id": "go",
"token_count": 253
} | 534 |
// compile
// Copyright 2021 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.
// issue 44739: cmd/compile: incorrect offset in MOVD
// load/store on ppc64/ppc64le causes assembler error.
// Test other 8 byte loads and stores ... | go/test/fixedbugs/issue44739.go/0 | {
"file_path": "go/test/fixedbugs/issue44739.go",
"repo_id": "go",
"token_count": 456
} | 535 |
// compile
// Copyright 2012 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.
// Issue 4529: escape analysis crashes on "go f(g())"
// when g has multiple returns.
package main
type M interface{}
type A struct {
a string
... | go/test/fixedbugs/issue4529.go/0 | {
"file_path": "go/test/fixedbugs/issue4529.go",
"repo_id": "go",
"token_count": 229
} | 536 |
// run
// Copyright 2021 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.
// This tickles a stack-allocation bug when the register ABI is enabled.
// The original report was from cue, internal/core/adt/equality.go,
// function... | go/test/fixedbugs/issue45851.go/0 | {
"file_path": "go/test/fixedbugs/issue45851.go",
"repo_id": "go",
"token_count": 514
} | 537 |
// errorcheck
// Copyright 2013 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.
// Issue 4654.
// Check error for conversion and 'not used' in defer/go.
package p
import "unsafe"
func f() {
defer int(0) // ERROR "defer re... | go/test/fixedbugs/issue4654.go/0 | {
"file_path": "go/test/fixedbugs/issue4654.go",
"repo_id": "go",
"token_count": 1001
} | 538 |
// compile -B
// Copyright 2021 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.
// Make sure that we can at least compile this code
// successfully with -B. We can't ever produce the right
// answer at runtime with -B, as the... | go/test/fixedbugs/issue48092.go/0 | {
"file_path": "go/test/fixedbugs/issue48092.go",
"repo_id": "go",
"token_count": 124
} | 539 |
package b
import "./a"
func F() {
a.MakePrivateCollection()
a.MakePrivateCollection2()
a.MakePrivateCollection3()
}
| go/test/fixedbugs/issue4879.dir/b.go/0 | {
"file_path": "go/test/fixedbugs/issue4879.dir/b.go",
"repo_id": "go",
"token_count": 56
} | 540 |
// run
// Copyright 2022 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.
// Issue 50671: sign extension eliminated incorrectly on MIPS64.
package main
//go:noinline
func F(x int32) (float64, int64) {
a := float64(x)
b := ... | go/test/fixedbugs/issue50671.go/0 | {
"file_path": "go/test/fixedbugs/issue50671.go",
"repo_id": "go",
"token_count": 229
} | 541 |
// run
// Copyright 2022 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 main
import "math"
func main() {
f()
g()
h()
j(math.MinInt64)
}
func f() {
for i := int64(math.MaxInt64); i <= math.MaxInt64; i++ {
if ... | go/test/fixedbugs/issue53600.go/0 | {
"file_path": "go/test/fixedbugs/issue53600.go",
"repo_id": "go",
"token_count": 372
} | 542 |
// run
//go:build !js && !wasip1
// Copyright 2024 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 main
import (
"bytes"
"fmt"
"os"
"os/exec"
"path/filepath"
)
const aSrc = `package a
func A() { println("a") ... | go/test/fixedbugs/issue54542.go/0 | {
"file_path": "go/test/fixedbugs/issue54542.go",
"repo_id": "go",
"token_count": 495
} | 543 |
// Copyright 2022 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 a
func F() { // ERROR "can inline F"
g(0) // ERROR "inlining call to g\[go.shape.int\]"
}
func g[T any](_ T) {} // ERROR "can inline g\[int\]" "can i... | go/test/fixedbugs/issue56280.dir/a.go/0 | {
"file_path": "go/test/fixedbugs/issue56280.dir/a.go",
"repo_id": "go",
"token_count": 133
} | 544 |
// run
// Copyright 2013 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.
// issue 5753: bad typecheck info causes escape analysis to
// not run on method thunks.
package main
type Thing struct{}
func (t *Thing) broken(s st... | go/test/fixedbugs/issue5753.go/0 | {
"file_path": "go/test/fixedbugs/issue5753.go",
"repo_id": "go",
"token_count": 188
} | 545 |
main.f
main.g
| go/test/fixedbugs/issue58300b.out/0 | {
"file_path": "go/test/fixedbugs/issue58300b.out",
"repo_id": "go",
"token_count": 8
} | 546 |
package p
import (
"./a" // ERROR "imported and not used: \x22test/a\x22 as surprise|imported and not used: surprise|\x22test/a\x22 imported as surprise and not used"
"./b" // ERROR "imported and not used: \x22test/b\x22 as surprise2|imported and not used: surprise2|\x22test/b\x22 imported as surprise2 and not used"... | go/test/fixedbugs/issue5957.dir/c.go/0 | {
"file_path": "go/test/fixedbugs/issue5957.dir/c.go",
"repo_id": "go",
"token_count": 271
} | 547 |
// run
// Copyright 2023 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 main
import (
"fmt"
"maps"
)
func main() {
m := map[string]struct{}{}
// Fill m up to the max for 4 buckets = 48 entries.
for i := 0; i ... | go/test/fixedbugs/issue62203.go/0 | {
"file_path": "go/test/fixedbugs/issue62203.go",
"repo_id": "go",
"token_count": 248
} | 548 |
// errorcheck
// Copyright 2014 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.
// Check for cycles in a pointer method expression.
package ptrmethexpr
type T int
func (*T) pm() int {
_ = x
return 0
}
var x = (*T).pm //... | go/test/fixedbugs/issue6703s.go/0 | {
"file_path": "go/test/fixedbugs/issue6703s.go",
"repo_id": "go",
"token_count": 111
} | 549 |
// errorcheck
// Copyright 2019 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
import "io"
// Alan's initial report.
type I interface { f(); String() string }
type J interface { g(); String() string }
type IJ1 ... | go/test/fixedbugs/issue6977.go/0 | {
"file_path": "go/test/fixedbugs/issue6977.go",
"repo_id": "go",
"token_count": 365
} | 550 |
// compile
// Copyright 2014 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.
// issue 7366: generates a temporary with ideal type
// during comparison of small structs.
package main
type T struct {
data [10]byte
}
func ma... | go/test/fixedbugs/issue7366.go/0 | {
"file_path": "go/test/fixedbugs/issue7366.go",
"repo_id": "go",
"token_count": 113
} | 551 |
// errorcheck
// Copyright 2014 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.
// Issue 7675: fewer errors for wrong argument count
package p
func f(string, int, float64, string)
func g(string, int, float64, ...string)
f... | go/test/fixedbugs/issue7675.go/0 | {
"file_path": "go/test/fixedbugs/issue7675.go",
"repo_id": "go",
"token_count": 297
} | 552 |
// compile
// Copyright 2014 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.
// /tmp/x.go:5: illegal constant expression: bool == interface {}
package p
var m = map[interface{}]struct{}{
nil: {},
true: {},
}
| go/test/fixedbugs/issue7996.go/0 | {
"file_path": "go/test/fixedbugs/issue7996.go",
"repo_id": "go",
"token_count": 97
} | 553 |
// compile
// Copyright 2014 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.
// issue 8073.
// was "internal compiler error: overflow: float64 integer constant"
package main
func main() {
var x int
_ = float64(x * 0)
}
| go/test/fixedbugs/issue8073.go/0 | {
"file_path": "go/test/fixedbugs/issue8073.go",
"repo_id": "go",
"token_count": 95
} | 554 |
// run
// Copyright 2014 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 main
func main() {
c := make(chan bool, 1)
ok := true
for i := 0; i < 12; i++ {
select {
case _, ok = <-c:
if i < 10 && !ok {
pan... | go/test/fixedbugs/issue8347.go/0 | {
"file_path": "go/test/fixedbugs/issue8347.go",
"repo_id": "go",
"token_count": 185
} | 555 |
// run
// Copyright 2014 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.
// Some uses of zeroed constants in non-assignment
// expressions broke with our more aggressive zeroing
// of assignments (internal compiler errors).
... | go/test/fixedbugs/issue8947.go/0 | {
"file_path": "go/test/fixedbugs/issue8947.go",
"repo_id": "go",
"token_count": 309
} | 556 |
// errorcheck
// Check flagging of invalid conversion of constant to float32/float64 near min/max boundaries.
// Copyright 2014 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 main
// See float_lit2.go for motivatio... | go/test/float_lit3.go/0 | {
"file_path": "go/test/float_lit3.go",
"repo_id": "go",
"token_count": 731
} | 557 |
// run
// Copyright 2009 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.
// A simple test of the garbage collector.
package main
func main() {
for i := 0; i < 1e5; i++ {
x := new([100]byte)
_ = x
}
}
| go/test/gc1.go/0 | {
"file_path": "go/test/gc1.go",
"repo_id": "go",
"token_count": 103
} | 558 |
// errorcheck
// Copyright 2009 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.
// Verify that erroneous initialization expressions are caught by the compiler
// Does not compile.
package main
type S struct {
A, B, C, X, Y... | go/test/initializerr.go/0 | {
"file_path": "go/test/initializerr.go",
"repo_id": "go",
"token_count": 503
} | 559 |
// Copyright 2011 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.
// Test that unexported methods are not visible outside the package.
// Does not compile.
package main
import "./private1"
type Exported interface {
private... | go/test/interface/private.dir/prog.go/0 | {
"file_path": "go/test/interface/private.dir/prog.go",
"repo_id": "go",
"token_count": 194
} | 560 |
// run
// Copyright 2009 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.
// Test communication with multiple simultaneous goroutines.
package main
import "runtime"
const N = 1000 // sent messages
const M = 10 // receivin... | go/test/ken/chan1.go/0 | {
"file_path": "go/test/ken/chan1.go",
"repo_id": "go",
"token_count": 398
} | 561 |
// run
// Copyright 2009 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.
// Test interface assignment.
package main
type Iputs interface {
puts (s string) string;
}
// ---------
type Print struct {
whoami int;
put Iput... | go/test/ken/intervar.go/0 | {
"file_path": "go/test/ken/intervar.go",
"repo_id": "go",
"token_count": 423
} | 562 |
// run
// Copyright 2009 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.
// Test simple functions.
package main
func
main() {
var x int;
x = fun(10,20,30);
if x != 60 { panic(x); }
}
func
fun(ia,ib,ic int)int {
var o ... | go/test/ken/simpfun.go/0 | {
"file_path": "go/test/ken/simpfun.go",
"repo_id": "go",
"token_count": 145
} | 563 |
// errorcheck
// 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.
// Tests that errors are reported for misuse of linkname.
package p
import _ "unsafe"
type t int
var x, y int
func F[T any](T) {}
//go:linkn... | go/test/linkname3.go/0 | {
"file_path": "go/test/linkname3.go",
"repo_id": "go",
"token_count": 224
} | 564 |
// errorcheck
// Copyright 2017 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.
// Ensure that typed non-integer, negative and too large
// values are not accepted as size argument in make for
// channels.
package main
type... | go/test/makechan.go/0 | {
"file_path": "go/test/makechan.go",
"repo_id": "go",
"token_count": 358
} | 565 |
// Copyright 2012 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.
// Test method expressions with arguments.
package main
import "./method4a"
type T1 int
type T2 struct {
f int
}
type I1 interface {
Sum([]int, int) int
... | go/test/method4.dir/prog.go/0 | {
"file_path": "go/test/method4.dir/prog.go",
"repo_id": "go",
"token_count": 974
} | 566 |
// errorcheck -0 -d=nil
//go:build wasm
// Copyright 2018 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.
// Test that nil checks are removed.
// Optimization is enabled.
package p
func f5(p *float32, q *float64, r *float3... | go/test/nilptr5_wasm.go/0 | {
"file_path": "go/test/nilptr5_wasm.go",
"repo_id": "go",
"token_count": 300
} | 567 |
// errorcheck -0 -d=ssa/prove/debug=1
//go:build amd64
package main
func invert(b func(), n int) {
for i := 0; i < n; i++ { // ERROR "(Inverted loop iteration|Induction variable: limits \[0,\?\), increment 1)"
b()
}
}
| go/test/prove_invert_loop_with_unused_iterators.go/0 | {
"file_path": "go/test/prove_invert_loop_with_unused_iterators.go",
"repo_id": "go",
"token_count": 91
} | 568 |
// run
// 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.
// Issue 38515: failed to mark the method wrapper
// reflect.Type.Method itself as REFLECTMETHOD.
package main
import "reflect"
var called bool
type... | go/test/reflectmethod5.go/0 | {
"file_path": "go/test/reflectmethod5.go",
"repo_id": "go",
"token_count": 188
} | 569 |
// errorcheck -0 -d=append,slice
// Copyright 2015 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.
// Check optimization results for append and slicing.
package main
func a1(x []int, y int) []int {
x = append(x, y) // ERRO... | go/test/sliceopt.go/0 | {
"file_path": "go/test/sliceopt.go",
"repo_id": "go",
"token_count": 272
} | 570 |
// errorcheck
// Copyright 2011 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.
// Verify that erroneous switch statements are detected by the compiler.
// Does not compile.
package main
type I interface {
M()
}
func bad(... | go/test/switch3.go/0 | {
"file_path": "go/test/switch3.go",
"repo_id": "go",
"token_count": 442
} | 571 |
// run
// Copyright 2022 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.
// absdiff example using a function argument rather than attaching an
// Abs method to a structure containing base types.
package main
import (
"fmt"... | go/test/typeparam/absdiff3.go/0 | {
"file_path": "go/test/typeparam/absdiff3.go",
"repo_id": "go",
"token_count": 974
} | 572 |
// Copyright 2021 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 main
import (
"./a"
"context"
"fmt"
"runtime"
"sort"
"sync"
"time"
)
func TestReadAll() {
c := make(chan int)
go func() {
c <- 4
c <- 2
... | go/test/typeparam/chansimp.dir/main.go/0 | {
"file_path": "go/test/typeparam/chansimp.dir/main.go",
"repo_id": "go",
"token_count": 1428
} | 573 |
// run
// Copyright 2021 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 main
import (
"fmt"
"reflect"
)
type Number interface {
~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uin... | go/test/typeparam/double.go/0 | {
"file_path": "go/test/typeparam/double.go",
"repo_id": "go",
"token_count": 683
} | 574 |
// run
// Copyright 2021 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 main
import (
"errors"
"fmt"
)
// _SliceEqual reports whether two slices are equal: the same length and all
// elements equal. All floating ... | go/test/typeparam/graph.go/0 | {
"file_path": "go/test/typeparam/graph.go",
"repo_id": "go",
"token_count": 2433
} | 575 |
// run
// Copyright 2021 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 main
func f[G any]() interface{} {
return func() interface{} {
return func() interface{} {
var x G
return x
}()
}()
}
func main() ... | go/test/typeparam/issue47684b.go/0 | {
"file_path": "go/test/typeparam/issue47684b.go",
"repo_id": "go",
"token_count": 149
} | 576 |
// run
// Copyright 2021 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 main
type Map[K comparable, V any] struct {
m map[K]V
}
func NewMap[K comparable, V any]() Map[K, V] {
return Map[K, V]{m: map... | go/test/typeparam/issue47877.go/0 | {
"file_path": "go/test/typeparam/issue47877.go",
"repo_id": "go",
"token_count": 187
} | 577 |
// compile
// Copyright 2021 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 main
type fun func()
func F[T any]() {
_ = fun(func() {
})
}
func main() {
F[int]()
}
| go/test/typeparam/issue47948.go/0 | {
"file_path": "go/test/typeparam/issue47948.go",
"repo_id": "go",
"token_count": 92
} | 578 |
// errorcheck
// Copyright 2021 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 main
func f[T interface{ ~[]P }, P any](t T) { // ERROR "instantiation cycle"
if t == nil {
return
}
f[[]T, T]([]T{t})
}
func main... | go/test/typeparam/issue48711.go/0 | {
"file_path": "go/test/typeparam/issue48711.go",
"repo_id": "go",
"token_count": 123
} | 579 |
// compile
// Copyright 2021 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 main
import "fmt"
type Fn[T any] func(T)
type FnErr[T any] func(T) error
// Test that local generic types across functions don't conflict... | go/test/typeparam/issue50177.go/0 | {
"file_path": "go/test/typeparam/issue50177.go",
"repo_id": "go",
"token_count": 857
} | 580 |
// Copyright 2022 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.
// Test that type substitution works and export/import works correctly even for a
// generic type that has multiple blank type params.
package main
import (
... | go/test/typeparam/issue50481c.dir/main.go/0 | {
"file_path": "go/test/typeparam/issue50481c.dir/main.go",
"repo_id": "go",
"token_count": 130
} | 581 |
// Copyright 2022 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 a
// Type I is the first basic test for the issue, which relates to a type that is recursive
// via a type constraint. (In this test, I -> IConstraint... | go/test/typeparam/issue51219.dir/a.go/0 | {
"file_path": "go/test/typeparam/issue51219.dir/a.go",
"repo_id": "go",
"token_count": 151
} | 582 |
// run
// Copyright 2022 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 main
import (
"fmt"
)
func main() {
x := [][]int{{1}}
y := [][]int{{2, 3}}
IntersectSS(x, y)
}
type list[E any] interface {
~[]E
Equal(... | go/test/typeparam/issue51303.go/0 | {
"file_path": "go/test/typeparam/issue51303.go",
"repo_id": "go",
"token_count": 518
} | 583 |
// run
// Copyright 2021 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 main
import (
"fmt"
)
type Ordered interface {
~int | ~int8 | ~int16 | ~int32 | ~int64 |
~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~u... | go/test/typeparam/list.go/0 | {
"file_path": "go/test/typeparam/list.go",
"repo_id": "go",
"token_count": 1120
} | 584 |
int bool
| go/test/typeparam/mdempsky/18.out/0 | {
"file_path": "go/test/typeparam/mdempsky/18.out",
"repo_id": "go",
"token_count": 3
} | 585 |
0,3: main.T[int;int]
4,7: main.T[int;main.U[int;int]·3]
22,23: main.T[main.Int;main.Int]
26,27: main.T[main.Int;main.U[main.Int;main.Int]·3]
| go/test/typeparam/nested.out/0 | {
"file_path": "go/test/typeparam/nested.out",
"repo_id": "go",
"token_count": 80
} | 586 |
// Copyright 2021 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 main
import (
"sort"
"./a"
)
func main() {
c := make(chan int, 1)
d := make(chan int, 1)
c <- 5
d <- 6
var r [2]int
r[0] = a.F(c, d)
r[1] ... | go/test/typeparam/select.dir/main.go/0 | {
"file_path": "go/test/typeparam/select.dir/main.go",
"repo_id": "go",
"token_count": 177
} | 587 |
// run
// Copyright 2021 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.
// Test method calls on type parameters
package main
import (
"fmt"
"reflect"
"strconv"
)
// Simple constraint
type Stringer interface {
String()... | go/test/typeparam/stringer.go/0 | {
"file_path": "go/test/typeparam/stringer.go",
"repo_id": "go",
"token_count": 615
} | 588 |
T 6
int 7
int32/int16 8
struct{T,T} 1 2
other 9
T 7
int32/int16 7
T 10
int 11
| go/test/typeparam/typeswitch2.out/0 | {
"file_path": "go/test/typeparam/typeswitch2.out",
"repo_id": "go",
"token_count": 41
} | 589 |
// run
// Copyright 2009 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.
// Test simple type switches on basic types.
package main
import "fmt"
const (
a = iota
b
c
d
e
)
var x = []int{1, 2, 3}
func f(x int, len *by... | go/test/typeswitch1.go/0 | {
"file_path": "go/test/typeswitch1.go",
"repo_id": "go",
"token_count": 673
} | 590 |
// run
// Copyright 2009 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.
// Test UTF-8 in strings and character constants.
package main
import "unicode/utf8"
func main() {
var chars [6]rune
chars[0] = 'a'
chars[1] = 'b'... | go/test/utf.go/0 | {
"file_path": "go/test/utf.go",
"repo_id": "go",
"token_count": 622
} | 591 |
/*
Copyright 2013 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... | groupcache/lru/lru.go/0 | {
"file_path": "groupcache/lru/lru.go",
"repo_id": "groupcache",
"token_count": 1134
} | 592 |
// Test that exported names have correct comments.
// Package pkg does something.
package pkg
import "time"
type T int // MATCH /exported type T.*should.*comment.*or.*unexport/
func (T) F() {} // MATCH /exported method T\.F.*should.*comment.*or.*unexport/
// this is a nice type.
// MATCH /comment.*exported type U.... | lint/testdata/4.go/0 | {
"file_path": "lint/testdata/4.go",
"repo_id": "lint",
"token_count": 347
} | 593 |
// Test that dot imports are flagged.
// Package pkg ...
package pkg
import . "fmt" // MATCH /dot import/
var _ Stringer // from "fmt"
| lint/testdata/import-dot.go/0 | {
"file_path": "lint/testdata/import-dot.go",
"repo_id": "lint",
"token_count": 47
} | 594 |
// Copyright 2016 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 bind
import (
"fmt"
"path"
"reflect"
"strings"
"unicode"
"unicode/utf8"
"golang.org/x/mobile/internal/importers"
"golang.org/x/mobile/internal... | mobile/bind/genclasses.go/0 | {
"file_path": "mobile/bind/genclasses.go",
"repo_id": "mobile",
"token_count": 12332
} | 595 |
// Copyright 2016 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.
#ifndef __GO_SEQ_ANDROID_HDR__
#define __GO_SEQ_ANDROID_HDR__
#include <stdint.h>
#include <android/log.h>
// For abort()
#include <stdlib.h>
#include <jni.h>
... | mobile/bind/java/seq_android.h/0 | {
"file_path": "mobile/bind/java/seq_android.h",
"repo_id": "mobile",
"token_count": 1146
} | 596 |
// Copyright 2014 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 seq
import "unicode/utf16"
// Based heavily on package unicode/utf16 from the Go standard library.
const (
replacementChar = '\uFFFD' // Unicode... | mobile/bind/seq/string.go/0 | {
"file_path": "mobile/bind/seq/string.go",
"repo_id": "mobile",
"token_count": 471
} | 597 |
// Code generated by gobind. DO NOT EDIT.
#include <jni.h>
#include "seq.h"
extern void init_proxies();
typedef struct ret_jint {
jint res;
jint exc;
} ret_jint;
typedef struct ret_jboolean {
jboolean res;
jint exc;
} ret_jboolean;
typedef struct ret_jshort {
jshort res;
jint exc;
} ret_jshort;
typedef struct... | mobile/bind/testdata/classes.java.h.golden/0 | {
"file_path": "mobile/bind/testdata/classes.java.h.golden",
"repo_id": "mobile",
"token_count": 1534
} | 598 |
// Objective-C API for talking to doc Go package.
// gobind -lang=objc doc
//
// File is generated by gobind. Do not edit.
#ifndef __GO_doc_H__
#define __GO_doc_H__
#include <stdint.h>
#include <objc/objc.h>
void cproxydoc_I_IM(int32_t refnum);
#endif
| mobile/bind/testdata/doc.objc.go.h.golden/0 | {
"file_path": "mobile/bind/testdata/doc.objc.go.h.golden",
"repo_id": "mobile",
"token_count": 108
} | 599 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.