Skip to content

cue/def: wrapping code in _#def #2250

@verdverm

Description

@verdverm

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

$ cue version
cue version v0.5.0-beta.5

go version go1.19.3
       -compiler gc
       -trimpath true
     CGO_ENABLED 0
          GOARCH amd64
            GOOS linux
         GOAMD64 v1

What did you do?

exec cue def input.cue
cmp stdout golden.stdout

-- input.cue --
package main

import "hof.io/repro/foo"

foo.#Foo

a: "A"

-- foo/foo.cue --
package foo

#Foo: {
	a: string
}

-- cue.mod/module.cue --
module: "hof.io/repro"

-- golden.stdout --
package main

import "hof.io/repro/foo"

foo.#Foo
a: "A"

What did you expect to see?

PASS and that the code looks the same before & after

What did you see instead?

The original code, wrapped in _#def

> exec cue def input.cue
[stdout]
package main

import "hof.io/repro/foo"

_#def
_#def: {
        foo.#Foo
        a: "A"
}
> cmp stdout golden.stdout
--- stdout
+++ golden.stdout
@@ -1,9 +0,0 @@
-package main
-
-import "hof.io/repro/foo"
-
-_#def
-_#def: {
-       foo.#Foo
-       a: "A"
-}

FAIL: /tmp/testscript3051149263/repro.txt/script.txtar:2: stdout and golden.stdout differ
error running repro.txt in /tmp/testscript3051149263/repro.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsDesignFunctionality seems desirable, but not sure how it should look like.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions