summaryrefslogtreecommitdiff
path: root/src/cmd/api/testdata
Commit message (Collapse)AuthorAgeFilesLines
* go/constant: switch to floating-point representation when fractions become ↵Robert Griesemer2015-12-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | too large Use two internal representations for Float values (similar to what is done for Int values). Transparently switch to a big.Float representation when big.Rat values become unwieldy. This is almost never needed for real-world programs but it is trivial to create test cases that cannot be handled with rational arithmetic alone. As a consequence, the go/constant API semantics changes slightly: Until now, a value could always be represented in its "smallest" form (e.g., float values that happened to be integers would be represented as integers). Now, constant Kind depends on how the value was created, rather than its actual value. (The reason why we cannot automatically "normalize" values to their smallest form anymore is because floating-point numbers are not exact in general; and thus normalization is often not possible in the first place, or would throw away precision when it is not desired.) This has repercussions as to how constant Values are used go/types and required corresponding adjustments. Details of the changes: go/constant package: - use big.Rat and big.Float values to represent floating-point values (internal change) - changed semantic of Value.Kind accordingly - String now returns a short, human-readable form of a value (this leads to better error messages in go/types) - added ToInt, ToFloat, and ToComplex conversion functions - added ExactString to obtain an exact string form of a value go/types: - adjusted and simplified implementation of representableConst - adjusted various places where Value.Kind was expected to be "smallest" by calling the respective ToInt/Float/Complex conversion functions - enabled 5 disabled tests in stdlib_test.go that now work api checker: - print all constant values in a short human-readable form (floats are printed in floating-point form), but also print an exact form if it is different from the short form - adjusted test golden file and go.1.1.text reference file Fixes #11327. Change-Id: I492b704aae5b0238e5b7cee13e18ffce61193587 Reviewed-on: https://go-review.googlesource.com/17360 Reviewed-by: Alan Donovan <adonovan@google.com> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/api: include constant valuesBrad Fitzpatrick2013-09-061-0/+8
| | | | | | | | Update #5935 R=golang-dev, rsc, iant, dave CC=golang-dev https://golang.org/cl/13261050
* cmd/api: rewrite using go/typesRobert Griesemer2013-08-082-11/+23
| | | | | | | | | | | | - adjusted test files so that they actually type-check - adjusted go1.txt, go1.1.txt, next.txt - to run, provide build tag: api_tool Fixes #4538. R=bradfitz CC=golang-dev https://golang.org/cl/12300043
* cmd/api: normalize byte to uint8 and rune to int32Brad Fitzpatrick2013-01-283-2/+15
| | | | | | R=golang-dev, adg, mikioh.mikioh CC=golang-dev https://golang.org/cl/7195049
* cmd/api: fix type scrubbingBrad Fitzpatrick2013-01-222-3/+9
| | | | | | | | | | | It wasn't removing names from func parameters for func types, and it was handling "a, b string" as "string", not "string, string". Fixes #4688 R=golang-dev, rsc CC=golang-dev https://golang.org/cl/7181051
* cmd/api: speed up API check by 2x, caching parser.ParseFile callsBrad Fitzpatrick2012-11-191-0/+22
| | | | | | | | | | | Saves 5 seconds on my machine. If Issue 4380 is fixed this clone can be removed. Update #4380 R=golang-dev, remyoudompheng, minux.ma, gri CC=golang-dev https://golang.org/cl/6845058
* cmd/api: bug fix for goapi's lame type checkerBrad Fitzpatrick2012-11-081-0/+6
| | | | | | | | | | | | | | This is blocking me submitting the net fd timeout CL, since goapi chokes on my constant. The much more extensive fix to goapi's type checker in pending review in https://golang.org/cl/6742050 But I'd rather get this quick fix in first. R=golang-dev, mikioh.mikioh CC=golang-dev https://golang.org/cl/6818104
* cmd/api: fix signatures like func(x, y, z int)Mikio Hara2012-09-192-0/+9
| | | | | | | | | | | Fixes writing of function parameter, result lists which consist of multiple named or unnamed items with same type. Fixes #4011. R=golang-dev, bsiegert, bradfitz, rsc CC=golang-dev https://golang.org/cl/6475062
* cmd/api: allow extension of interfaces with unexported methodsRuss Cox2012-09-182-1/+16
| | | | | | | | Fixes #4061. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/6525047
* cmd/api: work on Windows again, and make gccgo files work a bit moreBrad Fitzpatrick2012-03-112-1/+9
| | | | | | | | handle string and []byte conversions. R=golang-dev, dsymonds CC=golang-dev https://golang.org/cl/5754082
* cmd/api: record return type of functions for variable typecheck.Rémy Oudompheng2012-02-214-1/+22
| | | | | | | | | | | Also cleanup the resolveName method. Fixes failure on go/build declaration: var ToolDir = filepath.Join(...) R=golang-dev, bradfitz CC=golang-dev, remy https://golang.org/cl/5681043
* cmd/api: follow constant referencesBrad Fitzpatrick2012-02-102-0/+7
| | | | | | | | | | For gccgo. Also removes bunch of special cases. Fixes #2906 R=golang-dev, remyoudompheng CC=golang-dev https://golang.org/cl/5644050
* build: move goapi, quietgcc, cgo, gotype, ebnflint into go-toolRuss Cox2012-01-314-0/+204
R=golang-dev, r CC=golang-dev https://golang.org/cl/5552054