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

Update ignores watch expressions #5484

Open
ChrisPenner opened this issue Dec 6, 2024 · 0 comments
Open

Update ignores watch expressions #5484

ChrisPenner opened this issue Dec 6, 2024 · 0 comments
Labels

Comments

@ChrisPenner
Copy link
Contributor

update ignores definitions in watch expressions entirely.

```ucm:hide
scratch/main> builtins.merge lib.builtins
```

```unison
foo = 1
```

```ucm
scratch/main> update
```

```unison
> foo = 2
```

```ucm
scratch/main> update
scratch/main> view foo
```


--- 

Initial state:

```unison
a = 1
b = 2
x = a + b
```

```ucm
scratch/main> update
```

Make a type-changing update to a dependency of `x`,
also update `x`, but it's in a watch expression 👀

```unison
a = "foo"
b = "bar"
> x = a ++ b
```

```ucm
scratch/main> update
```

Output:

``` unison
foo = 1
```

``` ucm

Loading changes detected in scratch.u.

I found and typechecked these definitions in scratch.u. If you
do an `add` or `update`, here's how your codebase would
change:

    ⍟ These new definitions are ok to `add`:
    
    foo : Nat

```
``` ucm
scratch/main> update

Okay, I'm searching the branch for code that needs to be
updated...

Done.

```
``` unison
> foo = 2
```

``` ucm

Loading changes detected in scratch.u.

✅

scratch.u changed.

Now evaluating any watch expressions (lines starting with
`>`)... Ctrl+C cancels.

    1 | > foo = 2
        ⧩
        2

```
``` ucm
scratch/main> update

Okay, I'm searching the branch for code that needs to be
updated...

Done.

scratch/main> view foo

foo : Nat
foo = 1

```
-----

Initial state:

``` unison
a = 1
b = 2
x = a + b
```

``` ucm

Loading changes detected in scratch.u.

I found and typechecked these definitions in scratch.u. If you
do an `add` or `update`, here's how your codebase would
change:

    ⍟ These new definitions are ok to `add`:
    
    a : Nat
        (also named foo)
    b : Nat
    x : Nat

```
``` ucm
scratch/main> update

Okay, I'm searching the branch for code that needs to be
updated...

Done.

```
Make a type-changing update to a dependency of `x`,
also update `x`, but it's in a watch expression 👀

``` unison
a = "foo"
b = "bar"
> x = a ++ b
```

``` ucm

Loading changes detected in scratch.u.

I found and typechecked these definitions in scratch.u. If you
do an `add` or `update`, here's how your codebase would
change:

    ⍟ These names already exist. You can `update` them to your
    new definition:
    
    a : Text
        (The old definition is also named foo.)
    b : Text

Now evaluating any watch expressions (lines starting with
`>`)... Ctrl+C cancels.

    3 | > x = a ++ b
        ⧩
        "foobar"

```
``` ucm
scratch/main> update

Okay, I'm searching the branch for code that needs to be
updated...

That's done. Now I'm making sure everything typechecks...

Typechecking failed. I've updated your scratch file with the
definitions that need fixing. Once the file is compiling, try
`update` again.

```



🛑

The transcript failed due to an error in the stanza above. The error is:


Typechecking failed. I've updated your scratch file with the
definitions that need fixing. Once the file is compiling, try
`update` again.
@ChrisPenner ChrisPenner added the bug label Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant