close
Skip to content

experiment/try: cannot reference optional field #4347

@TLDMain

Description

@TLDMain

What version of CUE are you using (cue version)?

0.16.1

Does this issue reproduce with the latest stable release?

yes

What did you do?

@experiment(try)

({
	outer?: {
		opt?: {}
	}
	inner: {
		try {
			opt: outer?.opt? & {
				try {}
			}
		}
	}
}).inner

https://cuelang.org/play/?id=076Hu4eoYC6#w=function&i=cue&f=export&o=yaml

What did you expect to see?

{}

What did you see instead?

opt: cannot reference optional field: outer:
    -:9:9

Observations

It works as expected if we delete inner try block or use opt: outer? & instead opt: outer?.opt? &

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions