Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
c2fa45b9
Commit
c2fa45b9
authored
May 21, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow type name as key to accomodate anonymous fields.
update tests. R=ken OCL=29207 CL=29207
parent
bba10b3f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
4 deletions
+13
-4
src/cmd/gc/go.y
src/cmd/gc/go.y
+5
-0
test/golden.out
test/golden.out
+4
-0
test/initialize.go
test/initialize.go
+3
-3
test/initializerr.go
test/initializerr.go
+1
-1
No files found.
src/cmd/gc/go.y
View file @
c2fa45b9
...
@@ -1363,6 +1363,11 @@ keyval:
...
@@ -1363,6 +1363,11 @@ keyval:
{
{
$$ = nod(OKEY, $1, $3);
$$ = nod(OKEY, $1, $3);
}
}
| LATYPE '
:
' expr
{
$$ = nod(OKEY, newname($1), $3);
}
/*
/*
* function stuff
* function stuff
...
...
test/golden.out
View file @
c2fa45b9
...
@@ -26,6 +26,10 @@ panic PC=xxx
...
@@ -26,6 +26,10 @@ panic PC=xxx
=========== ./helloworld.go
=========== ./helloworld.go
hello, world
hello, world
=========== ./initializerr.go
BUG: errchk: ./initializerr.go:15: missing expected error: 'duplicate'
errchk: ./initializerr.go:17: missing expected error: 'index'
=========== ./peano.go
=========== ./peano.go
0! = 1
0! = 1
1! = 1
1! = 1
...
...
test/initialize.go
View file @
c2fa45b9
...
@@ -21,10 +21,10 @@ var a1 = S { 0, 0, 0, 1, 2, 3 }
...
@@ -21,10 +21,10 @@ var a1 = S { 0, 0, 0, 1, 2, 3 }
var
b1
=
S
{
X
:
1
,
Z
:
3
,
Y
:
2
}
var
b1
=
S
{
X
:
1
,
Z
:
3
,
Y
:
2
}
var
a2
=
S
{
0
,
0
,
0
,
0
,
0
,
0
,
}
var
a2
=
S
{
0
,
0
,
0
,
0
,
0
,
0
,
}
var
b2
S
// = S { } TODO(rsc): should work
var
b2
=
S
{
}
var
a3
=
T
{
S
{
1
,
2
,
3
,
0
,
0
,
0
,
}
}
var
a3
=
T
{
S
{
1
,
2
,
3
,
0
,
0
,
0
,
}
}
var
b3
=
T
{
S
{
A
:
1
,
B
:
2
,
C
:
3
}
}
// TODO(rsc): s/S/S:S/
var
b3
=
T
{
S
:
S
{
A
:
1
,
B
:
2
,
C
:
3
}
}
var
a4
=
&
[
16
]
byte
{
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
1
,
0
,
0
,
}
var
a4
=
&
[
16
]
byte
{
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
1
,
0
,
0
,
}
var
b4
=
&
[
16
]
byte
{
4
:
1
,
1
,
1
,
1
,
12
:
1
,
1
,
}
var
b4
=
&
[
16
]
byte
{
4
:
1
,
1
,
1
,
1
,
12
:
1
,
1
,
}
...
@@ -33,7 +33,7 @@ var a5 = &[16]byte { 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, }
...
@@ -33,7 +33,7 @@ var a5 = &[16]byte { 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, }
var
b5
=
&
[
16
]
byte
{
1
,
4
:
1
,
1
,
1
,
1
,
12
:
1
,
1
,
}
var
b5
=
&
[
16
]
byte
{
1
,
4
:
1
,
1
,
1
,
1
,
12
:
1
,
1
,
}
var
a6
=
&
[
16
]
byte
{
1
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
1
,
0
,
0
,
}
var
a6
=
&
[
16
]
byte
{
1
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
1
,
0
,
0
,
}
var
b6
=
&
[
...
]
byte
{
1
,
4
:
1
,
1
,
1
,
1
,
12
:
1
,
1
,
0
,
0
,}
// throws index out of range
var
b6
=
&
[
...
]
byte
{
1
,
4
:
1
,
1
,
1
,
1
,
12
:
1
,
1
,
0
,
0
,}
type
Same
struct
{
type
Same
struct
{
a
,
b
interface
{}
a
,
b
interface
{}
...
...
test/initializerr.go
View file @
c2fa45b9
...
@@ -22,4 +22,4 @@ var a4 = [5]byte{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } // ERROR "index"
...
@@ -22,4 +22,4 @@ var a4 = [5]byte{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } // ERROR "index"
var
a5
=
[]
byte
{
x
:
2
}
// ERROR "index"
var
a5
=
[]
byte
{
x
:
2
}
// ERROR "index"
var
ok1
=
S
{
}
// should be ok
var
ok1
=
S
{
}
// should be ok
var
ok2
=
T
{
S
:
a4
}
// should be ok
var
ok2
=
T
{
S
:
ok1
}
// should be ok
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment