1
0
mirror of https://github.com/golang/go synced 2024-09-25 05:10:12 -06:00
Commit Graph

347 Commits

Author SHA1 Message Date
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
Robert Griesemer
fec0c01e7f floating point bug
R=rsc
DELTA=35  (35 added, 0 deleted, 0 changed)
OCL=29442
CL=29444
2009-05-27 09:57:44 -07:00
Robert Griesemer
c376d5d7fc bad error message
TBR=rsc
DELTA=14  (14 added, 0 deleted, 0 changed)
OCL=29441
CL=29441
2009-05-27 09:47:13 -07:00
Ken Thompson
646927e48a and the golden file
R=r
OCL=29421
CL=29421
2009-05-26 19:58:59 -07:00
Rob Pike
70d711dfb8 bug150 is fixed
R=ken
OCL=29407
CL=29407
2009-05-26 16:06:03 -07:00
Russ Cox
c2fa45b973 allow type name as key to accomodate anonymous fields.
update tests.

R=ken
OCL=29207
CL=29207
2009-05-21 16:31:10 -07:00
Russ Cox
b9159722dd add test for yesterday's interface rule change (interface/convert1.go).
move interface tests to subdirectory.

R=r
DELTA=1632  (827 added, 804 deleted, 1 changed)
OCL=29181
CL=29191
2009-05-21 13:46:20 -07:00
Russ Cox
2da5022bcf change representation of interface values.
this is not a user-visible change.

before, all interface values were

	struct Itype {
		Sigt *type;
		Sigi *inter;
		void *method[n];
	}

	struct Iface {
		void *addr;
		Itype *itype;
	}

the itype is basically a vtable, but it's unnecessary
if the static type is interface{ }.
for interface values with static type empty, the
new representation is

	struct Eface {
		void *addr;
		Sigt *type;
	}

this complicates the code somewhat, but
it reduces the number of Itypes that
have to be computed and cached,
it opens up opportunities to avoid function
calls in a few common cases,
and it will make it possible to lay out
interface{} values at compile time,
which i think i'll need for the new reflection.

R=ken
OCL=28701
CL=29121
2009-05-20 14:57:55 -07:00
Russ Cox
a2ea790b1b bug152: literal []slice{ } as range expression
R=ken
OCL=28918
CL=28918
2009-05-15 13:17:07 -07:00
Ian Lance Taylor
025506d0a3 A comparison of two values with a type equivalent to string
gives an type mismatch error, although both values appear to
have the same type.

R=ken,rsc
DELTA=23  (23 added, 0 deleted, 0 changed)
OCL=28786
CL=28805
2009-05-14 06:25:40 -07:00
Russ Cox
7cf30cd49e bug150
R=ken
OCL=28785
CL=28785
2009-05-13 18:05:27 -07:00
Russ Cox
917aa35f8f implications of stricter type equality:
if both types are named, they must be
the same type (arising from the same
declaration).

R=r,gri
DELTA=44  (21 added, 4 deleted, 19 changed)
OCL=28436
CL=28577
2009-05-08 15:40:14 -07:00
Robert Griesemer
b3b3e0da94 conversion bug
R=r
DELTA=24  (24 added, 0 deleted, 0 changed)
OCL=28451
CL=28508
2009-05-08 09:58:25 -07:00
Russ Cox
b5e212ffdd 6g: error messages
replace "shape error across CALL" with more information.

x.go:7: not enough arguments to CALL
	a int, b int
	int
x.go:10: assignment count mismatch: 3 = 2
x.go:12: too many arguments to RETURN
	[no arguments expected]
	int, int, int

also leave type alone after conversion failure,
for later errors:

bug049.go:6: cannot convert nil constant to string
bug049.go:6: illegal types for operand: EQ
	string
	nil		# this used to be blank

R=ken
OCL=28405
CL=28407
2009-05-07 10:29:35 -07:00
Robert Griesemer
cc35ca529b wrong type used for dynamic type test
R=r
DELTA=40  (40 added, 0 deleted, 0 changed)
OCL=28308
CL=28311
2009-05-05 17:05:58 -07:00
Russ Cox
b8dd218e2e bug117 is fixed in 6g; now an errchk
R=r
DELTA=42  (20 added, 22 deleted, 0 changed)
OCL=28295
CL=28295
2009-05-05 13:41:46 -07:00
Russ Cox
21c9f82f40 update convlit.go to current spec
R=r
DELTA=17  (2 added, 9 deleted, 6 changed)
OCL=28286
CL=28286
2009-05-05 11:23:39 -07:00
Russ Cox
83e976d53e bug146: array/slice conversion before I left missed conversions
R=ken
OCL=28120
CL=28124
2009-04-30 13:49:58 -07:00
Ian Lance Taylor
625866a977 Conversion from array to slices should work like assignment:
you should be able to convert a pointer to an array to a
slice, you should not be able to convert an array to a slice.
Currently 6g works the other way around.

R=ken,rsc
DELTA=17  (17 added, 0 deleted, 0 changed)
OCL=28033
CL=28067
2009-04-29 20:15:59 -07:00
Ken Thompson
91ce0ef8f3 bug 139
R=r
OCL=27987
CL=27987
2009-04-28 13:52:56 -07:00
Ken Thompson
f2714e38a4 bug131 has been fixed with no change
R=r
OCL=27980
CL=27980
2009-04-28 13:04:01 -07:00
Ken Thompson
ad36c39211 bug 145
R=r
OCL=27979
CL=27979
2009-04-28 12:28:31 -07:00
Robert Griesemer
eaba458ee6 cannot declare a variable in new scope with same name as type in outer scope
(same as bug144.go but for types instead of constants)

TBR=ken
DELTA=17  (17 added, 0 deleted, 0 changed)
OCL=27855
CL=27855
2009-04-25 13:41:56 -07:00
Ken Thompson
b03b541b7a recognize a defined constant
as a new name in a later declaration
(bug 144)

R=r
OCL=27850
CL=27850
2009-04-24 16:43:31 -07:00
Robert Griesemer
516bf6535c - cannot declare local variable named like a constant in outer scope
- submitted per discussion w/ ken

TBR=ken
DELTA=25  (25 added, 0 deleted, 0 changed)
OCL=27824
CL=27826
2009-04-23 21:54:07 -07:00
Rob Pike
227fe8c530 bug143 is fixed
R=dsymonds
DELTA=58  (26 added, 32 deleted, 0 changed)
OCL=27698
CL=27698
2009-04-21 18:11:34 -07:00
Rob Pike
5689e6472c update golden for bug 143
R=dsymonds
DELTA=6  (6 added, 0 deleted, 0 changed)
OCL=27654
CL=27654
2009-04-21 00:05:19 -07:00
Russ Cox
a62467af93 fix stringrange test
R=ken
OCL=27353
CL=27353
2009-04-13 05:31:44 -07:00
Rob Pike
54ec719391 fix string range to have full unicode range (up to 10FFFF).
add test for string range.

test has minor failure: after loop the index == len(s); should be len(s)-1
in this case.  according to spec, vars are left at position at last
iteration.

R=ken,rsc
DELTA=259  (161 added, 96 deleted, 2 changed)
OCL=27343
CL=27343
2009-04-12 17:01:17 -07:00
Rob Pike
72d867660d bug142 is fixed
R=rsc
OCL=27331
CL=27331
2009-04-10 17:58:10 -07:00
Rob Pike
7d6c0018fb messages changed; updated golden.out for bug037
R=rsc
OCL=27248
CL=27248
2009-04-08 23:34:44 -07:00
Russ Cox
b8035ab5a5 bug142
R=ken
OCL=27202
CL=27202
2009-04-07 23:30:59 -07:00
Russ Cox
3067781ab9 func f() (int, int);
x := f();

used to give
	fatal error: dowidth fn struct struct { int; int }

now gives
	assignment count mismatch: 1 = 2

R=ken
OCL=27198
CL=27201
2009-04-07 22:20:37 -07:00
Rob Pike
a888d4d233 not a bug by current understanding, so delete this file.
6g says: bug138.go:8: constant -1 overflows uint
gccgo says: bug138.go:8:16: error: integer constant overflow

R=rsc
DELTA=19  (0 added, 19 deleted, 0 changed)
OCL=27099
CL=27149
2009-04-07 00:15:49 -07:00
Russ Cox
a99a7f60c3 tests changed - throw calls panic directly now
instead of dereferencing nil, so no more SIGSEGVs.

R=r
DELTA=28  (0 added, 14 deleted, 14 changed)
OCL=26881
CL=26881
2009-03-30 00:28:08 -07:00
Ken Thompson
a805e54a38 golden
R=r
OCL=26699
CL=26699
2009-03-24 16:47:33 -07:00
Rob Pike
7525e085d2 bug141 is fixed
R=ken
DELTA=56  (26 added, 30 deleted, 0 changed)
OCL=26628
CL=26628
2009-03-22 21:02:17 -07:00
Ian Lance Taylor
90943c8ee4 Test that interfaces work in type switches.
R=ken,rsc
DELTA=30  (30 added, 0 deleted, 0 changed)
OCL=26599
CL=26604
2009-03-20 16:30:54 -07:00
Ian Lance Taylor
1e39143966 Don't try to define the same label twice, as that produces a
label redefinition error.

R=gri
DELTA=6  (0 added, 0 deleted, 6 changed)
OCL=26357
CL=26372
2009-03-16 21:47:38 -07:00
Robert Griesemer
5a27079801 spec and implementation disagree with respect to label declarations
R=rsc
DELTA=19  (19 added, 0 deleted, 0 changed)
OCL=26284
CL=26336
2009-03-16 11:21:58 -07:00
Robert Griesemer
b260916a55 internal compiler error
R=rsc
DELTA=18  (18 added, 0 deleted, 0 changed)
OCL=26266
CL=26266
2009-03-13 14:14:50 -07:00
Russ Cox
5fbadf0bc3 warn -> yyerror in mparith.
close two more bugs.

R=ken
OCL=26226
CL=26226
2009-03-12 19:57:30 -07:00
Russ Cox
8f194bf5ff make 6g constants behave as ken proposes. (i hope.)
various bug fixes and tests involving constants.

test/const1.go is the major new test case.

R=ken
OCL=26216
CL=26224
2009-03-12 19:04:38 -07:00
Ken Thompson
767845b6fa bug 125
R=r
OCL=26146
CL=26146
2009-03-11 17:37:04 -07:00
Ken Thompson
48f6b516e2 bug 137
R=r
OCL=26142
CL=26142
2009-03-11 16:25:45 -07:00
Russ Cox
4eb7ceba58 complain when trying to put T into an interface
if T has pointer methods.  this is just a heuristic
but it catches the problem robert ran into and
lets me put the larger interface issues aside for
now.  found one bug in pretty.

R=ken
OCL=26141
CL=26141
2009-03-11 16:06:17 -07:00
Ken Thompson
d27e9f528d bug086
R=r
OCL=26090
CL=26090
2009-03-10 19:16:31 -07:00
Robert Griesemer
b2e91a9a29 constant conversion of int (non-ideal) constant doesn't work
R=rsc
DELTA=20  (20 added, 0 deleted, 0 changed)
OCL=26054
CL=26062
2009-03-10 16:39:23 -07:00
Russ Cox
63985b489b bug085 bug129
R=ken
OCL=25787
CL=25791
2009-03-05 15:57:03 -08:00