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

evaluator: eval3 produces errors, the old one doesn't #3805

Closed
loisch opened this issue Mar 8, 2025 · 2 comments
Closed

evaluator: eval3 produces errors, the old one doesn't #3805

loisch opened this issue Mar 8, 2025 · 2 comments

Comments

@loisch
Copy link

loisch commented Mar 8, 2025

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

$ cue version
cue version v0.12.0

go version go1.23.5
      -buildmode exe
       -compiler gc
       -trimpath true
  DefaultGODEBUG asynctimerchan=1,gotypesalias=0,httpservecontentkeepheaders=1,tls3des=1,tlskyber=0,x509keypairleaf=0,x509negativeserial=1
     CGO_ENABLED 1
          GOARCH arm64
            GOOS darwin
         GOARM64 v8.0
cue.lang.version v0.12.0

Does this issue reproduce with the latest stable release?

Yes, and also with a build of current commit 5d2da07.

What did you do?

The following reproducer shows different results with old and new evaluator:

env CUE_EXPERIMENT=evalv3=0
exec cue vet test.cue
env CUE_EXPERIMENT=evalv3=1
! exec cue vet test.cue

-- test.cue --
#PatientViewSections: {
	[string]: #PatientViewSection
}

#PatientViewSection: #PvSection

#PvSection: {
	Section: {
		display?: string
		entries:  #PatientViewEntries
	}
	_json: [for k, v in Section.entries {(k): v._json}]
}

#PatientViewEntries: [string]: #PatientViewEntry

#PatientViewEntry: {
	#PvSingleForm | #PvLink
}

#PvSingleForm: {
	SingleForm: {
		formId:                 string
		showNumberOfInstances?: bool
	}
	_json: [{
		"iDoc":     "singleFormIDoc"
		"X-FormId": SingleForm.formId
	},
		//if SingleForm.showNumberOfInstances != _|_ {
		//	"X-ShowNumberOfInstances": "\(SingleForm.showNumberOfInstances)"
		//}
	]
}

#PvLink: {
	Link: {
		icon?:    string
		sections: #PatientViewSections
	}
	_json: [for k, v in Link.sections {(k): v._json}]
}

#TabcatsJson: {
	config: {
		tabcats: #PatientViewSections
		...
	}
	json: {
		//tabcats: #OrgContents
		tabcats: [for k, v in config.tabcats {(k): v._json}]
	}
}

tabcatsExample: #TabcatsJson
tabcatsExample: {
	_e1: #PatientViewEntry
	_e1: {
		Link: {
			sections: "Formulare": {
				Section: entries: "Fotodokumentation": _e2
			}
		}
	}
	_e2: #PatientViewEntry
	_e2: {
		SingleForm: {
			formId: "fotodokumentation"
		}
	}
	_s: #PvSection
	_s: Section: entries: "Dokumentation": _e1
	config: {
		tabcats: "02": _s
	}
}

What did you expect to see?

A failing test. If the old evaluator is wrong and the new evaluator is right rejecting the file, I'd furthermore expect a better error message, because I don't understand what's wrong. I think the reason might be that #PvSection is used twice in the example and that these two instances are somehow unified. But that's just guessing.

What did you see instead?

A passing test.

@loisch loisch added NeedsInvestigation Triage Requires triage/attention labels Mar 8, 2025
@loisch
Copy link
Author

loisch commented Mar 19, 2025

Works with current master at 04fa872

@myitcv myitcv changed the title new evaluator produces errors, the old one doesn't evaluator: eval3 produces errors, the old one doesn't Mar 20, 2025
@myitcv
Copy link
Member

myitcv commented Mar 20, 2025

Thanks for testing, @loisch. I'm adding a regression test here to lock in the behaviour: https://review.gerrithub.io/c/cue-lang/cue/+/1211873

@myitcv myitcv added evaluator and removed Triage Requires triage/attention labels Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants