# `type.hole`

A `_` stands where a value goes, for one the code doesn't give yet.

Area 2, [Values and types](/docs/values-and-types.md); not declinable; the next step is usually the agent's.

## Why Jadpo refuses it

`_` written where a value goes asks the checker what goes there, and the
answer is this error: the type the place requires, written as the code
would write it, and up to five values in scope that fit, closest first.
It is always an error, so a project holding one never checks, runs its
tests or builds, and it can't be declined. A placeholder that compiles,
such as `""` or `0`, could ship unnoticed; a hole can't.

## What it looks like

main.jadpo:

```jadpo
type BookTitle = Text {
    max_length: 200
}

type Book = Object {
    title: BookTitle
    author: PersonName
}

function shelve(title: BookTitle, author: PersonName) -> Book {
    return Book {
        title: title
        author: _
    }
}
```

```text
error: `_` stands for a `PersonName`
 --> main.jadpo:13:17
   |
13 |         author: _
   |                 ^ a `PersonName` goes here
  reason: `PersonName` is an object: `PersonName { given: GivenName, family: FamilyName? }`. In scope, `author` fits.
  next: Write `author` (agent)
  fix:
    13 - author: _
    13 + author: author
  rule: type.hole
  help: https://jadpo.dev/docs/errors/type.hole

check failed: 1 error, 1 file

next: jadpo fix  fixes this error for you, then checks again
```

`(agent)` at the end of the `next:` line means your coding agent can make
the fix itself.

Where nothing in scope fits an object, the next step writes the object
out with a `_` for each field that can't be `none`, so the next check
says what goes in each:

```jadpo
type BookTitle = Text {
    max_length: 200
}

type Book = Object {
    title: BookTitle
    author: PersonName
}

function shelve(title: BookTitle) -> Book {
    return Book {
        title: title
        author: _
    }
}
```

```text
error: `_` stands for a `PersonName`
 --> main.jadpo:13:17
   |
13 |         author: _
   |                 ^ a `PersonName` goes here
  reason: `PersonName` is an object: `PersonName { given: GivenName, family: FamilyName? }`. Nothing in scope fits.
  next: Write `PersonName { given: _, family: none }`, and see `jadpo help PersonName` for the type (agent)
  fix:
    13 - author: _
    13 + author: PersonName { given: _, family: none }
  rule: type.hole
  help: https://jadpo.dev/docs/errors/type.hole

check failed: 1 error, 1 file

next: jadpo fix  fixes this error for you, then checks again
```

Where nothing around the `_` says its type, as for an operator's operand,
the error says so. `jadpo check --json` gives the
type as `expected` and each fit as `fits`, with its text, its type and the
edit that writes it, and hovering over the `_` in the editor shows the
same.

## How to fix it

**If one of the values that fit is the one meant**, write it in place of
the `_`:

```jadpo
        author: author
```


The value goes in as it is, so the project checks.

## Related

- [Typed holes](/docs/typed-holes.md)
- [Creating values](/docs/creating-values.md)
- [When one type can stand in for another](/docs/when-one-type-can-stand-in-for-another.md)
