Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

cmd/cue: trim default + optional interaction #759

Closed
vikstrous2 opened this issue Feb 11, 2021 · 2 comments
Closed

cmd/cue: trim default + optional interaction #759

vikstrous2 opened this issue Feb 11, 2021 · 2 comments
Labels
NeedsFix trim This issue is related to trim.

Comments

@vikstrous2
Copy link

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

$ cue version v0.3.0-beta.4 linux/amd64

Does this issue reproduce with the latest release?

yes

What did you do?

tmp.cue

#maybeString: {ip?: string}
something: ip: *"default" | string
something: #maybeString
cue trim tmp.cue

What did you expect to see?

I don't think this looks like something that can be trimmed, so probably no change.

What did you see instead?

  {
      #maybeString: close({
        ip?: string
      })
      something: {
-         ip: (*"default" | string) & string
+         ip?: string
      }
  }
Aborting trim, output differs after trimming. This is a bug! Use -i to force trim.
You can file a bug here: https://github.com/cuelang/cue/issues/new?assignees=&labels=NeedsInvestigation&template=bug_report.md&title=
@myitcv myitcv added FeatureRequest New feature or request trim This issue is related to trim. and removed NeedsInvestigation labels Feb 12, 2021
@myitcv myitcv changed the title trim bug: default + optional interaction cmd/cue: trim default + optional interaction Feb 12, 2021
@myitcv
Copy link
Contributor

myitcv commented Feb 12, 2021

Confirmed with 760aa11:

cp main.cue.golden main.cue
exec cue trim ./...
cmp main.cue main.cue.golden

-- main.cue.golden --
package main

#maybeString: {ip?: string}
something: ip: *"default" | string
something: #maybeString

Marking as a feature request because trim needs to be coded for each case.

@mpvl mpvl added NeedsFix and removed FeatureRequest New feature or request labels Feb 12, 2021
@mpvl mpvl added this to the v0.3.0-evaluator-rewrite milestone Feb 12, 2021
cueckoo pushed a commit that referenced this issue Feb 13, 2021
handle defaults in both directions.

This really seems to be a sumbsumption bug more than anything,
but this makes trim more robust either way.

Fixes #759

Change-Id: Iaadaf2c628f0e9a3a8edb268abdeb1d991adde18
cueckoo pushed a commit that referenced this issue Feb 13, 2021
handle defaults in both directions.

This really seems to be a sumbsumption bug more than anything,
but this makes trim more robust either way.

Fixes #759

Change-Id: Iaadaf2c628f0e9a3a8edb268abdeb1d991adde18
@cueckoo
Copy link

cueckoo commented Jul 3, 2021

This issue has been migrated to cue-lang/cue#759.

For more details about CUE's migration to a new home, please see cue-lang/cue#1078.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
NeedsFix trim This issue is related to trim.
Projects
None yet
Development

No branches or pull requests

4 participants