Skip to content

Commit

Permalink
Add a failing transcript for unisonweb#2822
Browse files Browse the repository at this point in the history
  • Loading branch information
sellout committed Aug 16, 2024
1 parent f2adc77 commit 5042914
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 0 deletions.
53 changes: 53 additions & 0 deletions unison-src/transcripts/fix2822.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Inability to reference a term or type with a name that has segments starting with an underscore

```ucm:hide
scratch/main> builtins.mergeio
```

There should be no issue having terms with an underscore-led component

```unison
_a.blah = 2
b = _a.blah + 1
```

Or even that _are_ a single “blank” component

```unison
_b = 2
x = _b + 1
```
Types can also have underscore-led components.

```unison
unique type _a.Blah = A
c : _a.Blah
c = A
```

And we should also be able to access underscore-led fields.

```unison
type Hello = {_value : Nat}
doStuff = _value.modify
```

But pattern matching shouldn’t bind to underscore-led names.

```unison:error
dontMap f = cases
None -> false
Some _used -> f _used
```

But we can use them as unbound patterns.

```unison
dontMap f = cases
None -> false
Some _unused -> f 2
```
49 changes: 49 additions & 0 deletions unison-src/transcripts/fix2822.output.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Inability to reference a term or type with a name that has segments starting with an underscore

There should be no issue having terms with an underscore-led component

``` unison
_a.blah = 2
b = _a.blah + 1
```

``` ucm
Loading changes detected in scratch.u.
I couldn't figure out what .blah refers to here:
3 | b = _a.blah + 1
I also don't know what type it should be.
Some common causes of this error include:
* Your current namespace is too deep to contain the
definition in its subtree
* The definition is part of a library which hasn't been
added to this project
* You have a typo in the name
```



🛑

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


I couldn't figure out what .blah refers to here:

3 | b = _a.blah + 1

I also don't know what type it should be.

Some common causes of this error include:
* Your current namespace is too deep to contain the
definition in its subtree
* The definition is part of a library which hasn't been
added to this project
* You have a typo in the name

0 comments on commit 5042914

Please sign in to comment.