-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/core/adt: strip "notDefault" status for disjunctions with un…
…used defaults This most fixes all known default issues. The semantics is still not entirely right, and will require a slightly different order of evaluation for disjunctions. This is best addressed when doing some of the planned performance enhancements for disjunctions. Fixes #763 Fixes #726 This CL changes the semantics as follows: 1) a marked disjunction becomes an unmarked disjunction if, after the conjuncts are distributed over disjuncts, none of its marked disjuncts remain 2) a nested disjunction a | b | (nestedA | nestedC) is evaluated according to the same rules, and then incorporated as is. This implementation still slightly deviates from these rules: The probem with the current implementation is that nested disjunctions are unified agaist existing conjuncts, and possibly eliminated early, before applying the rules. So in ``` ("a" | "b") & (*(*"a" | string) | string) ``` the inner `*"a" | string` is combined with `"a" | "b"` before it is determined whether its result is a marked disjunction. This was okay with the previous semantics and had the benefit of allowing to eliminate some disjuncts earlier, but no longer works with the new semantics. Also if we use structure sharing, the benefits of reuse will likely be bigger then early elimination in this case. Some of the complexity of the logic in this CL is introduced to deal with this discrepency. It can be simplified again considerably when the required change in control flow is implemented. Change-Id: I638bbb66ba69bd1642261dd2628dfcc27b14f893 Reviewed-on: https://cue-review.googlesource.com/c/cue/+/8706 Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
- Loading branch information
Showing
5 changed files
with
421 additions
and
83 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.