Commit Graph

395 Commits

Author SHA1 Message Date
Russ Cox
a186b77b03 gc: implement defer print/println/panic/panicln
Fixes #219.

R=ken2, r
CC=golang-dev
https://golang.org/cl/194097
2010-01-27 15:37:08 -08:00
Russ Cox
2a01d72878 gc: improved syntax errors
* example-based syntax errors (go.errors)

* enable bison's more specific errors
  and translate grammar token names into
  tokens like ++

* test cases

R=ken2, r, ken3
CC=golang-dev
https://golang.org/cl/194085
2010-01-26 23:13:22 -08:00
Russ Cox
7abb4b3a96 gc: fix chan <- chan precedence.
also allow func() func().

R=ken2
CC=golang-dev
https://golang.org/cl/194078
2010-01-26 10:40:28 -08:00
Robert Griesemer
f4dfbd1cf0 channel types parsed not according to spec by 6g
R=r, rsc
CC=golang-dev
https://golang.org/cl/193101
2010-01-25 22:10:35 -08:00
Russ Cox
1912632019 runtime, type switch: eliminate package global name space assumption
bonus: type switch now detects multiple uses of identical interface types.
bonus: interface types are now order-independent, following the spec.

R=ken2
CC=golang-dev
https://golang.org/cl/194053
2010-01-25 18:23:20 -08:00
Russ Cox
ee6b883101 add bug246 (issue 492)
R=r
CC=golang-dev
https://golang.org/cl/186216
2010-01-18 18:26:10 -08:00
Ian Lance Taylor
32e2ae0b18 Test order of evaluation in tuple assignments.
gccgo currently passes this test; 8g currently does not.  I
think I counted everything out right.

R=rsc
CC=golang-dev
https://golang.org/cl/186165
2010-01-15 14:02:53 -08:00
Russ Cox
307a899d5b gc: bug238
Fixes #471.

R=ken2
CC=golang-dev
https://golang.org/cl/181184
2010-01-08 00:01:03 -08:00
Robert Griesemer
c7bd61a216 Test case for issue 475 and related bug.
R=iant
CC=golang-dev
https://golang.org/cl/183087
2009-12-29 14:44:56 -08:00
Robert Griesemer
a947d0d0c1 test case for issue 471
R=iant
CC=golang-dev
https://golang.org/cl/183084
2009-12-29 14:01:09 -08:00
Adam Langley
50d6c81d4a runtime: fix race condition
(Thanks to ken and rsc for pointing this out)

rsc:
	ken pointed out that there's a race in the new
	one-lock-per-channel code.  the issue is that
	if one goroutine has gone to sleep doing

	select {
	case <-c1:
	case <-c2:
	}

	and then two more goroutines try to send
	on c1 and c2 simultaneously, the way that
	the code makes sure only one wins is the
	selgen field manipulation in dequeue:

	       // if sgp is stale, ignore it
	       if(sgp->selgen != sgp->g->selgen) {
		       //prints("INVALID PSEUDOG POINTER\n");
		       freesg(c, sgp);
		       goto loop;
	       }

	       // invalidate any others
	       sgp->g->selgen++;

	but because the global lock is gone both
	goroutines will be fiddling with sgp->g->selgen
	at the same time.

This results in a 7% slowdown in the single threaded case for a
ping-pong microbenchmark.

Since the cas predominantly succeeds, adding a simple check first
didn't make any difference.

R=rsc
CC=golang-dev
https://golang.org/cl/180068
2009-12-18 12:25:53 -08:00
Russ Cox
c6e316a4b9 gc: handle _ = <-c in select.
Fixes #238.

R=ken2
https://golang.org/cl/163098
2009-12-03 01:30:19 -08:00
Robert Griesemer
5fd4f76802 bug219: parsing difficulties with 6g
R=r, rsc
https://golang.org/cl/157085
2009-11-19 00:04:30 -08:00
Robert Griesemer
3c5dbb036b bug218.go: testcase for issue 238
R=rsc
https://golang.org/cl/154172
2009-11-16 17:53:39 -08:00
Russ Cox
da776791c4 drop output from nilptr tests;
too hard to make it the same everywhere.
still checking for non-zero exit status though.

disable core files while running tests

R=r
http://go/go-review/1026037
2009-11-09 23:11:36 -08:00
Russ Cox
71983af4a1 bug212, bug213.
R=ken
http://go/go-review/1026032
2009-11-08 23:22:06 -08:00
Russ Cox
9dd2e1e30f nil pointer checks in 8g.
fix nil pointer check in 6g.
was dereferencing after the ADD;
dereference before instead.

R=ken@golang.org
CC=iant
http://go/go-review/1016022
2009-11-01 21:04:16 -08:00
Ian Lance Taylor
f305d04943 Bug: 6g accepts fallthrough in type switch.
R=r
CC=go-dev
http://go/go-review/1016006
2009-10-29 15:41:02 -07:00
Ian Lance Taylor
eb63c3fec4 Test that the compiler rejects map types which should not be
compatible.

R=rsc
CC=go-dev
http://go/go-review/1018001
2009-10-28 17:09:24 -07:00
Russ Cox
60ff8cc86f address bug193 and add note to spec about it.
R=ken
OCL=35920
CL=35920
2009-10-20 08:27:14 -07:00
Russ Cox
02fd255a14 bug162, over and over
R=ken
OCL=35919
CL=35919
2009-10-20 08:03:43 -07:00
Russ Cox
a15648658f bug196
R=ken
OCL=35905
CL=35905
2009-10-19 21:10:29 -07:00
Russ Cox
62c4818ee0 bug136
R=ken
OCL=35902
CL=35904
2009-10-19 20:39:18 -07:00
Russ Cox
1be74762c1 bug169
R=ken
OCL=35899
CL=35899
2009-10-19 19:55:17 -07:00
Russ Cox
4c3a85d73a 6g bug fixes:
* bug211
 * embedded interfaces with lowercase methods
 * var _ = f() at top level

R=ken
OCL=35898
CL=35898
2009-10-19 19:27:40 -07:00
Russ Cox
8fffa1d698 bug190.
also eliminate float80 dregs

R=ken
OCL=35894
CL=35896
2009-10-19 18:47:37 -07:00
Rob Pike
e32883df01 bug 211: duplicate interface methods not caught by 6g
R=gri
DELTA=17  (17 added, 0 deleted, 0 changed)
OCL=35852
CL=35876
2009-10-19 11:47:42 -07:00
Robert Griesemer
b0dcc6b9a4 bug210
R=rsc
DELTA=20  (20 added, 0 deleted, 0 changed)
OCL=35847
CL=35847
2009-10-16 13:31:35 -07:00
Russ Cox
2372408189 sort errors by line number
turn off testdclstack and "not used" errors
when there are syntax errors.

BUG=2181825
R=ken
OCL=35606
CL=35608
2009-10-12 11:03:48 -07:00
Russ Cox
867e10f241 fix build
TBR=r
OCL=35592
CL=35592
2009-10-11 23:38:44 -07:00
Robert Griesemer
d5c4142758 bug209.go
R=rsc
DELTA=23  (22 added, 1 deleted, 0 changed)
OCL=35529
CL=35537
2009-10-09 15:28:09 -07:00
Russ Cox
680ee6af63 add & fix bug208, from ken.
fix bug198.

R=ken
OCL=35504
CL=35507
2009-10-08 23:03:34 -07:00
Russ Cox
2204cfddea fix bug206.
delay calls to savex as long as possible.

R=ken
OCL=34535
CL=34546
2009-09-10 17:33:01 -07:00
Russ Cox
757fe32fe7 fix bug206 output on different platforms
TBR=r
OCL=34524
CL=34524
2009-09-10 13:43:15 -07:00
Robert Griesemer
82540ebdf0 bug206
R=rsc
DELTA=51  (51 added, 0 deleted, 0 changed)
OCL=34516
CL=34516
2009-09-10 10:30:36 -07:00
Russ Cox
e780fa8669 defining package block names must override
universe block names.

BUG=2097244
R=ken
OCL=34295
CL=34473
2009-09-09 01:01:39 -07:00
Russ Cox
620dc595ff missed in last compiler change
R=ken
OCL=34348
CL=34348
2009-09-03 16:18:03 -07:00
Russ Cox
262b6462aa fix bug187 (itself buggy)
R=austin
DELTA=26  (0 added, 26 deleted, 0 changed)
OCL=34294
CL=34317
2009-09-03 10:59:52 -07:00
Ian Lance Taylor
79606b9952 Cascading errors lead to a compiler crash.
R=rsc
DELTA=18  (18 added, 0 deleted, 0 changed)
OCL=33914
CL=33917
2009-08-26 16:24:51 -07:00
Russ Cox
d66d65da96 bug132
R=ken
OCL=33792
CL=33803
2009-08-24 17:06:10 -07:00
Russ Cox
ef3e6810b8 bug189
R=ken
OCL=33745
CL=33745
2009-08-24 09:23:04 -07:00
Russ Cox
ac9d833c1e half of bug193
R=ken
OCL=33730
CL=33730
2009-08-23 18:09:44 -07:00
Russ Cox
59e2e54eab fix bug195
R=ken
OCL=33700
CL=33700
2009-08-21 18:07:11 -07:00
Russ Cox
e1c5d179d6 fix crash in bug194; add bug196
R=ken
OCL=33694
CL=33697
2009-08-21 17:54:07 -07:00
Ian Lance Taylor
5261be20eb A test for an interface which uses a forward declared type
which turns out to be invalid.

R=rsc
DELTA=15  (15 added, 0 deleted, 0 changed)
OCL=33691
CL=33693
2009-08-21 17:42:41 -07:00
Ian Lance Taylor
1f1551f179 Test composite literals with undeclared types. This crashed
gccgo in a few different places, and crashes 6g as of this
writing.  Note that the index in a composite literal must be
looked up in a different namespace if the composite literal
type turns out to be a struct.

R=rsc
DELTA=36  (36 added, 0 deleted, 0 changed)
OCL=33681
CL=33685
2009-08-21 16:09:17 -07:00
Robert Griesemer
cfa52e5e0b unexpected shift conversion behavior
R=r
DELTA=20  (20 added, 0 deleted, 0 changed)
OCL=33646
CL=33667
2009-08-21 14:14:25 -07:00
Russ Cox
e107afddc5 fix build
TBR=r
OCL=33623
CL=33623
2009-08-20 17:36:21 -07:00
Rob Pike
770485e522 add bug to capture double declaration of name in file and package block
R=rsc
DELTA=12  (12 added, 0 deleted, 0 changed)
OCL=33554
CL=33563
2009-08-19 17:37:23 -07:00
Russ Cox
5600435fe4 produce diagnostic for
import "fmt"
var fmt = 1

R=ken
OCL=33556
CL=33561
2009-08-19 17:27:08 -07:00
Ian Lance Taylor
42e9db134b Test that a type can refer to itself recursively as long as it
does so in ways that permit its size to be known.

R=rsc
DELTA=35  (35 added, 0 deleted, 0 changed)
OCL=33427
CL=33433
2009-08-17 19:23:17 -07:00
Rob Pike
74dd0ab670 fix up some irregular indentation
R=rsc
OCL=33382
CL=33391
2009-08-17 13:30:22 -07:00
Robert Griesemer
6f911ccaa5 6g bug: struct initializers must provide all field values unless the fields are named
R=rsc,r
DELTA=16  (16 added, 0 deleted, 0 changed)
OCL=33292
CL=33303
2009-08-14 15:13:32 -07:00
Russ Cox
66beb2fd3b fix bug187 not to crash
TBR=austin
DELTA=9  (4 added, 4 deleted, 1 changed)
OCL=33115
CL=33115
2009-08-12 14:54:15 -07:00
Austin Clements
f60203666b Bug involving ... initializers and interface values.
R=rsc
APPROVED=rsc
DELTA=22  (22 added, 0 deleted, 0 changed)
OCL=33053
CL=33104
2009-08-12 13:57:05 -07:00
Russ Cox
6be0f50b97 bug159
R=ken
OCL=32902
CL=32914
2009-08-07 16:47:54 -07:00
Russ Cox
99eca57d43 clean up a few error messages;
disable func redeclaration mismatch test;
fix golden.out

R=ken
OCL=32883
CL=32883
2009-08-07 13:00:20 -07:00
Russ Cox
9dc22b6d6f more 6g reorg; checkpoint.
typecheck.c is now responsible for all type checking
except for assignment and function argument "..."

R=ken
OCL=32661
CL=32667
2009-08-03 11:58:52 -07:00
Russ Cox
34b277f046 use errchk in more places.
let errchk exit 0 even if it has reported a BUG.
it echoed BUG and that's all that matters.

R=r
DELTA=143  (1 added, 89 deleted, 53 changed)
OCL=32533
CL=32542
2009-07-30 16:46:14 -07:00
Russ Cox
bbeb2276de fixed golden.out, which is what 32496 should have done.
roll back 32496

TBR=austin
OCL=32499
CL=32501
2009-07-29 18:33:31 -07:00
Russ Cox
c217c16a06 bug136 unfixed
R=austin
DELTA=35  (21 added, 14 deleted, 0 changed)
OCL=32469
CL=32474
2009-07-29 15:39:05 -07:00
Russ Cox
1ff5897d64 tweak final line of test output:
4 known bugs; 0 unexpected bugs

which should be less scary to people
unfamiliar with the tests.

R=r
DELTA=44  (29 added, 12 deleted, 3 changed)
OCL=32460
CL=32464
2009-07-29 15:11:19 -07:00
Russ Cox
2946069e3f break and continue fixes
labeled break/continue was using
first loop with any label,
not first loop with the right label.

R=ken
OCL=32453
CL=32458
2009-07-29 14:49:01 -07:00
Russ Cox
9271c6402e introduce typecheck pass before walkexpr.
not complete but compiler still works.

R=ken
OCL=32424
CL=32426
2009-07-29 12:47:51 -07:00
Russ Cox
eece85c9a7 move bug148, already fixed, to fixedbugs
R=ken
OCL=32257
CL=32257
2009-07-27 17:32:02 -07:00
Russ Cox
b7dd312c93 bug170; fix test for bug175
R=ken
OCL=32255
CL=32255
2009-07-27 17:24:07 -07:00
Russ Cox
a587d9a73f multiple return in := bug
R=ken
OCL=32253
CL=32253
2009-07-27 16:59:10 -07:00
Russ Cox
dbba489951 do not echo command in errchk,
so that golden.out does not include
the name of the compiler (which is
arch-specific and shows up in diffs).

R=r,iant
DELTA=3  (0 added, 0 deleted, 3 changed)
OCL=31980
CL=31983
2009-07-21 19:45:06 -07:00
Ian Lance Taylor
c9399f13f8 You can't set a fixed array to nil.
R=r
DELTA=12  (12 added, 0 deleted, 0 changed)
OCL=31915
CL=31936
2009-07-21 14:05:21 -07:00
Russ Cox
940e381b75 triple quote
R=ken
OCL=31868
CL=31874
2009-07-20 14:15:36 -07:00
Russ Cox
db508ccbff baby step: const decls can refer to future
consts in the same factored block

	const (
		X = Y;
		Y = 2;
	)

R=ken
OCL=31782
CL=31782
2009-07-17 13:38:16 -07:00
Russ Cox
e52e9ca82e another step toward eliminating forward declarations.
introduce NodeList* type in compiler to replace OLIST.
this clarifies where lists can and cannot occur.
list append and concatenation are now cheap.
the _r rules are gone from yacc.
rev and unrev are gone.
no more lists of lists.

the representation of assignments is a bit clunkier.
split into OAS (1=1) and OAS2 (2 or more on one side).

delete dead chanrecv3 code.

delay construction of func types.

R=ken
OCL=31745
CL=31762
2009-07-17 01:00:44 -07:00
Russ Cox
be16caf872 step toward no function prototypes.
delay evaluation of most types (all but func)
from parse time to type check time.

R=ken
OCL=31585
CL=31585
2009-07-13 23:38:39 -07:00
Russ Cox
e11447f7da bug148.
R=ken
OCL=31582
CL=31582
2009-07-13 23:29:44 -07:00
Russ Cox
a1b64821f8 bug167
R=ken
OCL=31295
CL=31295
2009-07-07 11:48:22 -07:00
Russ Cox
80e4a053d7 update tests for new reflect
R=r
DELTA=12  (0 added, 0 deleted, 12 changed)
OCL=31240
CL=31290
2009-07-07 11:04:51 -07:00
Robert Griesemer
985390bc52 bug167: types declared in different scopes should
be independent of each other

R=rsc
DELTA=28  (28 added, 0 deleted, 0 changed)
OCL=31271
CL=31273
2009-07-07 10:42:42 -07:00
Russ Cox
1af3edc37f maps have == so maps should work as map keys.
fix tests of bad map keys to use slices instead.

R=r
DELTA=7  (0 added, 1 deleted, 6 changed)
OCL=31123
CL=31145
2009-07-03 09:45:15 -07:00
Russ Cox
5d5904bb4d bug163 bug164 bug166
R=ken
OCL=30889
CL=30889
2009-06-29 17:46:22 -07:00
Russ Cox
df36629d76 bug041 not a bug.
can now forward declare across files

R=r
DELTA=15  (0 added, 15 deleted, 0 changed)
OCL=30873
CL=30880
2009-06-29 17:21:33 -07:00
Ian Lance Taylor
6a71f43f82 6g appears to permit semicolons to be omitted after qualified
identifiers.  This is not one of the exceptions permitted by
th spec.

R=ken,rsc
DELTA=11  (11 added, 0 deleted, 0 changed)
OCL=30844
CL=30852
2009-06-29 12:52:08 -07:00
Russ Cox
480f51243c bug165
R=ken
OCL=30783
CL=30783
2009-06-25 21:02:39 -07:00
Rob Pike
7de4883412 cannot have interfaces refer to themselves as map keys
R=rsc
DELTA=11  (11 added, 0 deleted, 0 changed)
OCL=30774
CL=30774
2009-06-25 18:44:28 -07:00
Rob Pike
23d9197160 canonicalize bug122.go
R=rsc
DELTA=6  (1 added, 3 deleted, 2 changed)
OCL=30604
CL=30604
2009-06-22 14:40:08 -07:00
Robert Griesemer
fe537dc8d5 `` strings should not accept newlines as characters
R=r
DELTA=17  (17 added, 0 deleted, 0 changed)
OCL=30417
CL=30422
2009-06-17 11:44:51 -07:00
Rob Pike
acaba18bba bug163: ideographs are not letters
also update golden.out from bug162

R=rsc
DELTA=16  (16 added, 0 deleted, 0 changed)
OCL=30298
CL=30324
2009-06-15 21:13:28 -07:00
Russ Cox
3751b259cb bug140 is fixed
R=ken
OCL=29989
CL=29999
2009-06-06 19:28:01 -07:00
Russ Cox
0d2c63a0b9 update golden.out with new compiler errors
R=r
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=29986
CL=29988
2009-06-06 17:01:14 -07:00
Russ Cox
70ce47058e bug in parallel assignment
R=r
DELTA=40  (40 added, 0 deleted, 0 changed)
OCL=29850
CL=29855
2009-06-03 17:26:53 -07:00
Ken Thompson
c17ce9f94f prevent multiple similar errors
in complex literals. side effect is
fix of error in initializerr.go

R=r
OCL=29667
CL=29667
2009-05-31 13:02:24 -07:00
Ian Lance Taylor
8cbb5d03bf Adjust expected errors to work with gccgo.
The change to assign.go is because the gcc testsuite fails to
handle .* in a normal way: it matches against the entire
compiler output, not just a single line.

assign.go:15:6: error: incompatible types in assignment (implicit assignment of 'sync.Mutex' hidden field 'key')
assign.go:19:6: error: incompatible types in assignment (implicit assignment of 'sync.Mutex' hidden field 'key')
assign.go:23:6: error: incompatible types in assignment (implicit assignment of 'sync.Mutex' hidden field 'key')
assign.go:27:6: error: incompatible types in assignment (implicit assignment of 'sync.Mutex' hidden field 'key')

chan/perm.go:14:5: error: incompatible types in assignment
chan/perm.go:15:5: error: incompatible types in assignment
chan/perm.go:16:6: error: incompatible types in assignment
chan/perm.go:17:6: error: incompatible types in assignment
chan/perm.go:24:7: error: invalid send on receive-only channel
chan/perm.go:25:12: error: invalid send on receive-only channel
chan/perm.go:31:4: error: invalid receive on send-only channel
chan/perm.go:32:9: error: invalid receive on send-only channel
chan/perm.go:38:2: error: invalid send on receive-only channel
chan/perm.go:42:2: error: invalid receive on send-only channel

initializerr.go:14:17: error: reference to undefined variable 'X'
initializerr.go:14:19: error: mixture of field and value initializers
initializerr.go:15:26: error: duplicate value for field 'Y'
initializerr.go:16:10: error: too many values in struct composite literal
initializerr.go:18:19: error: index expression is not integer constant
initializerr.go:17:11: error: too many elements in composite literal

R=rsc
DELTA=12  (0 added, 0 deleted, 12 changed)
OCL=29657
CL=29665
2009-05-31 11:18:52 -07:00
Russ Cox
d6a9817051 bug157
R=ken
OCL=29651
CL=29653
2009-05-30 21:18:15 -07:00
Ken Thompson
be63b6dc44 bug 158
R=r
OCL=29646
CL=29646
2009-05-30 17:06:51 -07:00
Robert Griesemer
705f9af38e Replacement for abandoned CL 29626:
bug157 and bug158

R=rsc
DELTA=59  (59 added, 0 deleted, 0 changed)
OCL=29632
CL=29634
2009-05-29 16:43:24 -07:00
Ken Thompson
fbcbcdbb1d bug 156
R=r
OCL=29623
CL=29623
2009-05-29 15:34:47 -07:00
Ken Thompson
1c7bee0567 bug 155
R=r
OCL=29619
CL=29619
2009-05-29 14:42:24 -07:00
Russ Cox
cc7c31baa4 64-bit integer math bugs
R=r
DELTA=46  (46 added, 0 deleted, 0 changed)
OCL=29569
CL=29614
2009-05-29 13:46:43 -07:00
Ken Thompson
3b37b02834 bug 149
R=r
OCL=29612
CL=29612
2009-05-29 13:44:30 -07:00
Ken Thompson
b3f303ec9a bug 153
R=r
OCL=29479
CL=29479
2009-05-27 18:37:02 -07:00
Russ Cox
18890eebbf fix bug154; tweak bug153 exit status
R=ken
OCL=29448
CL=29448
2009-05-27 10:16:13 -07:00