Skip to content

Commit bc6c485

Browse files
committed
core/toposort: stop trying to order structinfos/structlits
A Vertex has a Structs field which contains StructInfos for all the structs that contributed to this vertex. Previously, I was attempting to build a graph from these StructInfos. This necessitated storing the parent of a struct in its StructInfo. However, even if this is working perfectly, the results are not perfect. For example: ``` y: b: 2 x: { c: 1 y a: 1 } ``` Here, the Vertex for `x` would contain two StructInfos, but we still wouldn't be able to establish that the `{b: 2}` struct should be processed after `c: 1` and before `a: 1`. This is because the vertex for `x` does not know there was an embedding. However, here: ``` x: { c: 1 if true { b: 2 } a: 1 } ``` on master, this extra parent info would allow us to get the ordering right, (i.e. c, then b, then a). This is because we would discover that `{b: 2}`'s ancestor is `x`, This CL removes this extra parent information completely. This means the above two examples now behave the same (b, then c, then a), which is wrong, but it's more consistent. It also simplifies the code substantially. It also makes the behaviour of evalv3 closer to evalv2. Signed-off-by: Matthew Sackman <[email protected]> Change-Id: I973230e591894b4b4018b66e2967f65339d1026a Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1211097 Unity-Result: CUE porcuepine <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Marcel van Lohuizen <[email protected]>
1 parent 5d2da07 commit bc6c485

26 files changed

+60
-400
lines changed

.github/workflows/evict_caches.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121
run: touch -t 202211302355 $(find * -type d)
2222
- name: Restore git file modification times
2323
uses: chetan/git-restore-mtime-action@075f9bc9d159805603419d50f794bd9f33252ebe
24-
- name: Try to extract Dispatch-Trailer
25-
id: DispatchTrailer
24+
- id: DispatchTrailer
25+
name: Try to extract Dispatch-Trailer
2626
run: |-
2727
x="$(git log -1 --pretty='%(trailers:key=Dispatch-Trailer,valueonly)')"
2828
if [[ "$x" == "" ]]
@@ -38,11 +38,11 @@ jobs:
3838
echo "value<<EOD" >> $GITHUB_OUTPUT
3939
echo "$x" >> $GITHUB_OUTPUT
4040
echo "EOD" >> $GITHUB_OUTPUT
41-
- name: Check we don't have Dispatch-Trailer on a protected branch
42-
if: |-
41+
- if: |-
4342
((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, '
4443
Dispatch-Trailer: {"type":"')))) && (contains(github.event.head_commit.message, '
4544
Dispatch-Trailer: {"type":"'))
45+
name: Check we don't have Dispatch-Trailer on a protected branch
4646
run: |-
4747
echo "github.event.head_commit.message contains Dispatch-Trailer but we are on a protected branch"
4848
false

.github/workflows/trybot.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,12 @@ jobs:
140140
Dispatch-Trailer: {"type":"')))) || (github.ref == 'refs/heads/ci/test')) && (matrix.go-version == '1.24.x' && matrix.runner == 'ubuntu-24.04')
141141
name: gcloud setup for end-to-end tests
142142
uses: google-github-actions/setup-gcloud@v2
143-
- env:
144-
CUE_TEST_TOKEN: ${{ secrets.E2E_PORCUEPINE_CUE_TOKEN }}
145-
if: |-
143+
- if: |-
146144
github.repository == 'cue-lang/cue' && (((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, '
147145
Dispatch-Trailer: {"type":"')))) || (github.ref == 'refs/heads/ci/test')) && (matrix.go-version == '1.24.x' && matrix.runner == 'ubuntu-24.04')
148146
name: End-to-end test
147+
env:
148+
CUE_TEST_TOKEN: ${{ secrets.E2E_PORCUEPINE_CUE_TOKEN }}
149149
run: |-
150150
cd internal/_e2e
151151
go test -race

cmd/cue/cmd/testdata/script/cmd_issue2060.txtar

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ StrokesName: ZenStrokes1
136136
PlatformName: Linux
137137
CommandBindingsCount: 1
138138
CommandBindings:
139-
- BindingsMax: 0
139+
- EditorCmdText: '"command": "move", "args": test'
140+
BindingsMax: 0
140141
CmdName: CursorMoveToLineForward
141142
CmdHumanName: Cursor Down
142-
EditorCmdText: '"command": "move", "args": test'
143143
BindingsCount: 1
144144
Bindings:
145145
- DefText: Down

cmd/cue/cmd/testdata/script/issue269.txtar

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ data: {
2727
}
2828
data: {
2929
a: {
30-
x: 0
31-
y: 0
3230
i: 0
3331
j: 0
34-
}
35-
b: {
3632
x: 0
3733
y: 0
34+
}
35+
b: {
3836
i: 0
3937
j: 0
38+
x: 0
39+
y: 0
4040
}
4141
}

cmd/cue/cmd/testdata/script/issue986.txtar

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ cmp stdout expect-stdout
3131

3232
-- expect-stdout --
3333
a: aaa
34-
ab: aaabbb
3534
b: bbb
35+
ab: aaabbb
3636
cd: cccddd

cmd/cue/cmd/testdata/script/modget_initial.txtar

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ deps: {
6565
}
6666
-- want-stdout-1 --
6767
{
68-
"foo.com/bar/hello@v0": "v0.2.3",
6968
"bar.com@v0": "v0.5.0",
7069
"baz.org@v0": "v0.10.2",
70+
"foo.com/bar/hello@v0": "v0.2.3",
7171
"main": "main",
7272
"example.com@v0": "v0.0.1"
7373
}
@@ -93,9 +93,9 @@ deps: {
9393
}
9494
-- want-stdout-2 --
9595
{
96-
"foo.com/bar/hello@v0": "v0.2.3",
9796
"bar.com@v0": "v0.5.0",
9897
"baz.org@v0": "v0.11.0-alpha",
98+
"foo.com/bar/hello@v0": "v0.2.3",
9999
"main": "main",
100100
"example.com@v0": "v0.0.1"
101101
}

cmd/cue/cmd/testdata/script/modmirror_initial.txtar

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ mirroring foo.com/bar/[email protected]
3535
3636
-- want-export-stdout --
3737
{
38-
"foo.com/bar/hello@v0": "v0.2.3",
3938
"bar.com@v0": "v0.5.0",
4039
"baz.org@v0": "v0.10.1",
40+
"foo.com/bar/hello@v0": "v0.2.3",
4141
"main": "main",
4242
"example.com@v0": "v0.0.1"
4343
}

cmd/cue/cmd/testdata/script/modmirror_modmode.txtar

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ mirroring [email protected]
3535
mirroring foo.com/bar/[email protected]
3636
-- want-export-stdout --
3737
{
38-
"foo.com/bar/hello@v0": "v0.2.3",
3938
"bar.com@v0": "v0.5.0",
4039
"baz.org@v0": "v0.10.1",
40+
"foo.com/bar/hello@v0": "v0.2.3",
4141
"main": "main",
4242
"example.com@v0": "v0.0.1"
4343
}

cmd/cue/cmd/testdata/script/modmirror_nodeps.txtar

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ mirroring [email protected]
2323
failed to resolve "foo.com/bar/hello": cannot find module providing package foo.com/bar/hello
2424
-- want-export-stdout --
2525
{
26-
"foo.com/bar/hello@v0": "v0.2.3",
2726
"bar.com@v0": "v0.5.0",
2827
"baz.org@v0": "v0.10.1",
28+
"foo.com/bar/hello@v0": "v0.2.3",
2929
"main": "main",
3030
"example.com@v0": "v0.0.1"
3131
}

cmd/cue/cmd/testdata/script/modtidy_initial.txtar

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ deps: {
4040
}
4141
-- want-stdout --
4242
{
43-
"foo.com/bar/hello@v0": "v0.2.3",
4443
"bar.com@v0": "v0.5.0",
4544
"baz.org@v0": "v0.10.1",
45+
"foo.com/bar/hello@v0": "v0.2.3",
4646
"main": "main",
4747
"example.com@v0": "v0.0.1"
4848
}

0 commit comments

Comments
 (0)