Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ugly workaround for #2566 issue #2589

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

bozaro
Copy link
Contributor

@bozaro bozaro commented Sep 11, 2023

Based on PR (only the last commit is important):

This change breaks backward compatibility, but I couldn't think of anything better.

I try explain this workaround by example cue/testdata/eval/let_funcs.txtar:

import "strings"
#Foo: {
	#a: string
	#b: string
	foo: strings.HasPrefix("\(#a)", #b)
}
foo: {
	let env_context = #Foo & {
		#a: "hello"
		#b: "world"
	}
	e1: env_context
	e2: env_context
	e3: env_context
	e4: env_context
	e5: env_context
	e6: env_context
	e7: env_context
	e8: env_context
}

In original code:

  • let env_context call strings.HasPrefix at the first time and create finazlied *adt.Vertex (vertex_1). This *adt.Vertex also contains *adt.CallExpr somewhere in conjuncts;
  • e1: env_context create new *adt.Vertex (vertex_2). On creating vertex_2 executed n.addVertexConjuncts(v, arc, false) with vertex_1 as arc;
  • addVertexConjuncts internally add all conjuncts from vertex_1 to vertex_2;
  • vertex_2 finalization reevaluates *adt.CallExpr from added conjuncts.

After this workaround vertex_1 became data and lost conjuncts with *adt.CallExpr node.

Signed-off-by: Artem V. Navrotskiy <bozaro@yandex.ru>
Signed-off-by: Artem V. Navrotskiy <bozaro@yandex.ru>
Signed-off-by: Artem V. Navrotskiy <bozaro@yandex.ru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant