Skip to content
This repository was archived by the owner on May 19, 2026. It is now read-only.
This repository was archived by the owner on May 19, 2026. It is now read-only.

Function declarations with explicit type annotations compile to the wrong Erlang code #103

Description

@tmbb

Describe the bug

Explicit type annotations seem to compile to the wrong Erlang code.

To Reproduce

(* example.ml *)
let f (x : int) : int = x + 1

compiles to:

% Source code generated with Caramel.
-module(example).

-export([f/1]).

-spec f(integer()) -> integer().
f(_) -> erlang:'+'(fun x/0, 1).

Expected behavior

I'd expect something like this:

% Source code generated with Caramel.
-module(example).

-export([f/1]).

-spec f(integer()) -> integer().
f(X) -> erlang:'+'(X, 1).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions