# V2003 not_callable

URL: /docs/errors/V2003
Markdown: /docs/errors/V2003.md

> The callee of a call expression is not a function: a value of another type is followed by (…).

An error from the `type` phase. `sakura explain V2003` prints this explanation offline.

The callee of a call expression is not a function: a value of another type is followed by
`(…)`. Check that the name refers to the function you meant (a local can shadow it), or remove
the call.

Wrong:

```sakura
let x = 1
x(2)
```

Fixed:

```sakura
let x = fn(n: Int) { n + 1 }
x(2)
```

## Wrong program [#wrong-program]

[`compiler/tests/ui/V2003_not_callable.sakura`](https://github.com/icantcodefyi/sakuralang/blob/master/compiler/tests/ui/V2003_not_callable.sakura), which the compiler's ui suite runs through `sakura check`:

```sakura
fn call() -> Int {
  let x = 1
  x(2)
}
```

`sakura check --json` reports this record (pretty-printed; `$DIR` is the fixture's directory):

```json
{
  "schema_version": "1.0",
  "kind": "diagnostic",
  "id": "d:ac6f003eea3f17d8",
  "code": "V2003",
  "severity": "error",
  "phase": "type",
  "message": "`Int` is not a function, so it cannot be called",
  "snapshot": "sha256:$SNAPSHOT",
  "symbol_id": "main::V2003_not_callable::call",
  "spans": [
    {
      "uri": "file://$DIR/V2003_not_callable.sakura",
      "content_hash": "sha256:3fa13dd548ca2d0ccd72eaaa3fba486cdf2d3296071bc7d16c036474f7c6c401",
      "start_byte": 67,
      "end_byte": 71,
      "role": "primary"
    }
  ],
  "related_ids": [],
  "expected": null,
  "actual": null,
  "obligation": null,
  "counterexample": null,
  "explanation_uri": "sakura://explain/V2003",
  "fixes": []
}
```

## Fixed program [#fixed-program]

[`compiler/tests/ui/V2003_not_callable.fixed.sakura`](https://github.com/icantcodefyi/sakuralang/blob/master/compiler/tests/ui/V2003_not_callable.fixed.sakura), which `sakura check` accepts with no diagnostics:

```sakura
fn call() -> Int {
  let x = fn(n: Int) { n + 1 }
  x(2)
}
```
