make _lookupNByKey return an Optional#193
Merged
roger-bosman-da merged 1 commit intoda-master-8.8.1from Apr 21, 2026
Merged
Conversation
paulbrauner-da
approved these changes
Apr 21, 2026
roger-bosman-da
added a commit
to digital-asset/daml
that referenced
this pull request
Apr 24, 2026
In theory, `damlc` catches calls to lookupbykey with negative (yielding an error) or 0 (yielding the empty list `[]`) n. That being said, to accomodate handwritten LF and to be a bit more precies, we wrap the `lookupbykey` in an optional, where `None` indicates failiure (such as a n < 1). This PR implements the daml side of this change. - Change "the staging version" (compiler always just knows of 1) to rc2 - Change the type of the builtin `ULookupNByKey` to include an Optional - alter `lookupNByKey` to force the Optional, yielding an error if it is None (it should never be None when compiling with damlc, since `n < 1` is already caught by the implementation of `lookupNByKey` - move all lookup functions to Prelude and hide/reexport what needs to be in DA.ContractKeys (this way `lookupByKey` can use `lookupNByKey` and does not have to repeat the fromOption`) - updated haddoc (fixes #22673) Furthermore, since the change involves a change to the daml-lf json, the golden check was uncommented as well. Canton companion PR: DACH-NY/canton#32018 GHC companion PR: digital-asset/ghc#193 Steps taken: 1. [DONE] Daml ad-hoc release that sets type to optional 2. [DONE] Canton ad-hoc release with DamlScriptIT tests (the only one who use daml) disabled 3. [DONE] Daml ad-hoc release depending on canton ad-hoc of step 2 4. [DONE] Merge canton in main depending on daml ad-hoc of step 3 4. [IN PROGRESS] Merge sdk in main depending on canton snapshot of step 4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In theory, damlc catches calls to lookupbykey with negative (yielding an error) or 0 (yielding the empty list []) n. That being said, to accomodate handwritten LF and to be a bit more precies, we wrap the lookupbykey in an optional, where None indicates failiure (such as a n < 1).
This PR implements the GHC side of this change
Daml companion PR: digital-asset/daml#22894
Canton companion PR: https://github.com/DACH-NY/canton/pull/32018