compiler-core
src
docs
javascript
language_server
parse
type_
test-output
test-package-compiler
test-project-compiler
···
1
1
---
2
2
source: compiler-core/src/docs/tests.rs
3
3
expression: "compile_with_markdown_pages(config, modules, pages,\nCompileWithMarkdownPagesOpts::default())"
4
4
-
snapshot_kind: text
5
4
---
6
5
//// LICENSE.html
7
6
···
1
1
---
2
2
source: compiler-core/src/docs/tests.rs
3
3
expression: "compile(config, modules)"
4
4
-
snapshot_kind: text
5
4
---
6
5
//// app.html
7
6
···
1
1
---
2
2
source: compiler-core/src/docs/tests.rs
3
3
expression: "compile(config, modules)"
4
4
-
snapshot_kind: text
5
4
---
6
5
//// app.html
7
6
···
1
1
---
2
2
source: compiler-core/src/docs/tests.rs
3
3
expression: "compile(config, modules)"
4
4
-
snapshot_kind: text
5
4
---
6
5
//// app.html
7
6
···
1
1
---
2
2
source: compiler-core/src/docs/tests.rs
3
3
expression: "compile(config, modules)"
4
4
-
snapshot_kind: text
5
4
---
6
5
//// app.html
7
6
···
1
1
---
2
2
source: compiler-core/src/docs/tests.rs
3
3
expression: "compile_with_markdown_pages(config, vec![], pages,\nCompileWithMarkdownPagesOpts::default())"
4
4
-
snapshot_kind: text
5
4
---
6
5
//// one.html
7
6
···
1
1
---
2
2
source: compiler-core/src/docs/tests.rs
3
3
expression: "compile_with_markdown_pages(config, modules, pages,\nCompileWithMarkdownPagesOpts { hex_publish: Some(DocContext::Build) })"
4
4
-
snapshot_kind: text
5
4
---
6
5
//// LICENSE.html
7
6
···
1
1
---
2
2
source: compiler-core/src/docs/tests.rs
3
3
expression: json
4
4
-
snapshot_kind: text
5
4
---
6
5
{"items":[{"type":"module","parentTitle":"gleam/option","title":"gleam/option","doc":"","ref":"gleam/option.html"},{"type":"type","parentTitle":"gleam/option","title":"Option","doc":"`Option` represents a value that may be present or not. `Some` means the value is present, `None` means the value is not.","ref":"gleam/option.html#Option"},{"type":"function","parentTitle":"gleam/option","title":"unwrap","doc":"Extracts the value from an `Option`, returning a default value if there is none.","ref":"gleam/option.html#unwrap"},{"type":"constant","parentTitle":"gleam/dynamic/decode","title":"bool","doc":"A decoder that decodes `Bool` values.\n\n # Examples\n\n \n let result = decode.run(dynamic.from(True), decode.bool)\n assert result == Ok(True)\n \n","ref":"gleam/dynamic/decode.html#bool"}],"proglang":"gleam"}
···
1
1
---
2
2
source: compiler-core/src/docs/tests.rs
3
3
expression: "compile(config, modules)"
4
4
-
snapshot_kind: text
5
4
---
6
5
//// app.html
7
6
···
1
1
-
---
2
2
-
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
expression: "\nfn go(x) {\n let n = 16\n let assert <<a:bits-size(n)>> = x\n}\n"
4
4
-
---
5
5
-
----- SOURCE CODE
6
6
-
7
7
-
fn go(x) {
8
8
-
let n = 16
9
9
-
let assert <<a:bits-size(n)>> = x
10
10
-
}
11
11
-
12
12
-
13
13
-
----- ERROR
14
14
-
error: Unsupported feature for compilation target
15
15
-
┌─ /src/javascript/error.gleam:4:16
16
16
-
│
17
17
-
4 │ let assert <<a:bits-size(n)>> = x
18
18
-
│ ^^^^^^^^^^^^^^
19
19
-
20
20
-
This bit array size option in patterns is not supported for JavaScript compilation.
···
1
1
-
---
2
2
-
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
expression: "\nfn go(x) {\n let n = 16\n let assert <<a:size(n)>> = x\n}\n"
4
4
-
---
5
5
-
----- SOURCE CODE
6
6
-
7
7
-
fn go(x) {
8
8
-
let n = 16
9
9
-
let assert <<a:size(n)>> = x
10
10
-
}
11
11
-
12
12
-
13
13
-
----- ERROR
14
14
-
error: Unsupported feature for compilation target
15
15
-
┌─ /src/javascript/error.gleam:4:16
16
16
-
│
17
17
-
4 │ let assert <<a:size(n)>> = x
18
18
-
│ ^^^^^^^^^
19
19
-
20
20
-
Non-constant size option in patterns is not supported for JavaScript compilation.
···
1
1
---
2
2
source: compiler-core/src/language_server/tests/action.rs
3
3
-
assertion_line: 4432
4
3
expression: "\npub type Wibble {\n OneTwo(wibble: Int, next: Wibble)\n ThreeFour(wobble: Float, text: String, values: List(Bool))\n FiveSixSeven(one_two: Int)\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- BEFORE ACTION
8
6
···
1
1
---
2
2
source: compiler-core/src/language_server/tests/action.rs
3
3
-
assertion_line: 5199
4
3
expression: "\nimport gleam/io\n\npub fn main(x) {\n case x {\n True -> {\n let message = \"Hello!\"\n io.println(message)\n }\n False -> Nil\n }\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- BEFORE ACTION
8
6
···
1
1
-
---
2
2
-
source: compiler-core/src/parse/tests.rs
3
3
-
expression: case a
4
4
-
---
5
5
-
[
6
6
-
Expression(
7
7
-
Case {
8
8
-
location: SrcSpan {
9
9
-
start: 0,
10
10
-
end: 6,
11
11
-
},
12
12
-
subjects: [
13
13
-
Var {
14
14
-
location: SrcSpan {
15
15
-
start: 5,
16
16
-
end: 6,
17
17
-
},
18
18
-
name: "a",
19
19
-
},
20
20
-
],
21
21
-
clauses: [],
22
22
-
},
23
23
-
),
24
24
-
]
···
1
1
---
2
2
source: compiler-core/src/type_/tests/errors.rs
3
3
expression: "-1.8e308"
4
4
-
snapshot_kind: text
5
4
---
6
5
----- SOURCE CODE
7
6
-1.8e308
···
1
1
---
2
2
source: compiler-core/src/type_/tests/errors.rs
3
3
expression: const x = -1.8e308
4
4
-
snapshot_kind: text
5
4
---
6
5
----- SOURCE CODE
7
6
const x = -1.8e308
···
1
1
---
2
2
source: compiler-core/src/type_/tests/errors.rs
3
3
expression: "let assert [-1.8e308, b] = [x, y]"
4
4
-
snapshot_kind: text
5
4
---
6
5
----- SOURCE CODE
7
6
let assert [-1.8e308, b] = [x, y]
···
1
1
---
2
2
source: compiler-core/src/type_/tests/errors.rs
3
3
expression: "1.8e308"
4
4
-
snapshot_kind: text
5
4
---
6
5
----- SOURCE CODE
7
6
1.8e308
···
1
1
---
2
2
source: compiler-core/src/type_/tests/errors.rs
3
3
expression: const x = 1.8e308
4
4
-
snapshot_kind: text
5
4
---
6
5
----- SOURCE CODE
7
6
const x = 1.8e308
···
1
1
---
2
2
source: compiler-core/src/type_/tests/errors.rs
3
3
expression: "let assert [1.8e308, b] = [x, y]"
4
4
-
snapshot_kind: text
5
4
---
6
5
----- SOURCE CODE
7
6
let assert [1.8e308, b] = [x, y]
···
1
1
-
---
2
2
-
source: compiler-core/src/type_/tests/errors.rs
3
3
-
expression: "\npub fn main() {\n case todo {\n 1 -> Ok(2)\n _ -> {\n todo\n 1\n }\n }\n}\n"
4
4
-
---
5
5
-
----- SOURCE CODE
6
6
-
7
7
-
pub fn main() {
8
8
-
case todo {
9
9
-
1 -> Ok(2)
10
10
-
_ -> {
11
11
-
todo
12
12
-
1
13
13
-
}
14
14
-
}
15
15
-
}
16
16
-
17
17
-
18
18
-
----- ERROR
19
19
-
error: Type mismatch
20
20
-
┌─ /src/one/two.gleam:5:5
21
21
-
│
22
22
-
5 │ ╭ _ -> {
23
23
-
6 │ │ todo
24
24
-
7 │ │ 1
25
25
-
│ │ ^ Did you mean to wrap this in an `Ok`?
26
26
-
8 │ │ }
27
27
-
│ ╰─────^
28
28
-
29
29
-
This case clause was found to return a different type than the previous
30
30
-
one, but all case clauses must return the same type.
31
31
-
32
32
-
Expected type:
33
33
-
34
34
-
Result(Int, a)
35
35
-
36
36
-
Found type:
37
37
-
38
38
-
Int
···
1
1
---
2
2
source: test-output/src/tests/echo.rs
3
3
-
assertion_line: 191
4
3
expression: output
5
5
-
snapshot_kind: text
6
4
---
7
5
--- main.gleam ----------------------
8
6
pub fn main() {
···
1
1
---
2
2
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 8
4
3
expression: "./cases/alias_unqualified_import"
5
4
---
6
5
//// /out/lib/the_package/_gleam_artefacts/one.cache
···
1
1
---
2
2
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 21
4
3
expression: "./cases/duplicate_module"
5
4
---
6
5
error: Duplicate module
···
9
8
10
9
First: src/main.gleam
11
10
Second: test/main.gleam
12
12
-
···
1
1
---
2
2
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 63
4
3
expression: "./cases/erlang_escape_names"
5
4
---
6
5
//// /out/lib/the_package/_gleam_artefacts/one.cache
···
1
1
---
2
2
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 74
4
3
expression: "./cases/erlang_import"
5
4
---
6
5
//// /out/lib/the_package/_gleam_artefacts/one.cache
···
1
1
---
2
2
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 85
4
3
expression: "./cases/erlang_import_shadowing_prelude"
5
4
---
6
5
//// /out/lib/the_package/_gleam_artefacts/one.cache
···
1
1
---
2
2
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 96
4
3
expression: "./cases/erlang_nested"
5
4
---
6
5
//// /out/lib/the_package/_gleam_artefacts/one@two.cache
···
1
1
---
2
2
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 118
4
3
expression: "./cases/hello_joe"
5
4
---
6
5
//// /out/lib/the_package/_gleam_artefacts/hello_joe.cache
···
1
1
---
2
2
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 173
4
3
expression: "./cases/imported_external_fns"
5
4
---
6
5
//// /out/lib/the_package/_gleam_artefacts/one.cache
···
1
1
---
2
2
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 237
4
3
expression: "./cases/not_overwriting_erlang_module"
5
4
---
6
5
//// /out/lib/the_package/_gleam_artefacts/app@code.cache
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 249
4
4
-
expression: "./cases/opaque_type_construct"
5
5
-
---
6
6
-
error: Unknown variable
7
7
-
┌─ src/two.gleam:7:3
8
8
-
│
9
9
-
7 │ User(name: "Alim", score: 10)
10
10
-
│ ^ Did you mean `Error`?
11
11
-
12
12
-
The name `User` is not in scope here.
13
13
-
···
1
1
---
2
2
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 273
4
3
expression: "./cases/overwriting_erlang_module"
5
4
---
6
5
error: Erlang module name collision
···
1
1
---
2
2
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 316
4
3
expression: "./cases/variable_or_module"
5
4
---
6
5
//// /out/lib/the_package/_gleam_artefacts/main.cache
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 8
4
4
-
expression: "./cases/alias_unqualified_import"
5
5
-
---
6
6
-
//// /out/lib/the_package/_gleam_artefacts/one.cache
7
7
-
<.cache binary>
8
8
-
9
9
-
//// /out/lib/the_package/_gleam_artefacts/one.cache_meta
10
10
-
<77 byte binary>
11
11
-
12
12
-
//// /out/lib/the_package/_gleam_artefacts/one.erl
13
13
-
-module(one).
14
14
-
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
15
15
-
16
16
-
-export([id/1]).
17
17
-
-export_type([empty/0]).
18
18
-
19
19
-
-type empty() :: empty.
20
20
-
21
21
-
-file("src/one.gleam", 2).
22
22
-
-spec id(I) -> I.
23
23
-
id(X) ->
24
24
-
X.
25
25
-
26
26
-
27
27
-
//// /out/lib/the_package/_gleam_artefacts/two.cache
28
28
-
<.cache binary>
29
29
-
30
30
-
//// /out/lib/the_package/_gleam_artefacts/two.cache_meta
31
31
-
<88 byte binary>
32
32
-
33
33
-
//// /out/lib/the_package/_gleam_artefacts/two.erl
34
34
-
-module(two).
35
35
-
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
36
36
-
37
37
-
-export([make/0]).
38
38
-
39
39
-
-file("src/two.gleam", 4).
40
40
-
-spec make() -> one:empty().
41
41
-
make() ->
42
42
-
one:id(empty).
43
43
-
44
44
-
45
45
-
//// /out/lib/the_package/ebin/importy.app
46
46
-
{application, importy, [
47
47
-
{vsn, "0.1.0"},
48
48
-
{applications, []},
49
49
-
{description, ""},
50
50
-
{modules, [one,
51
51
-
two]},
52
52
-
{registered, []}
53
53
-
]}.
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 21
4
4
-
expression: "./cases/duplicate_module"
5
5
-
---
6
6
-
error: Duplicate module
7
7
-
8
8
-
The module `main` is defined multiple times.
9
9
-
10
10
-
First: src/main.gleam
11
11
-
Second: test/main.gleam
12
12
-
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
expression: "./cases/erlang_app_generation"
4
4
-
---
5
5
-
//// /out/lib/the_package/_gleam_artefacts/main.cache
6
6
-
<.cache binary>
7
7
-
8
8
-
//// /out/lib/the_package/_gleam_artefacts/main.cache_meta
9
9
-
<49 byte binary>
10
10
-
11
11
-
//// /out/lib/the_package/_gleam_artefacts/main.erl
12
12
-
-module(main).
13
13
-
14
14
-
15
15
-
//// /out/lib/the_package/ebin/my_erlang_application.app
16
16
-
{application, my_erlang_application, [
17
17
-
{mod, {'my_erlang_application_sup', []}},
18
18
-
{vsn, "0.1.0"},
19
19
-
{applications, [gleam_otp,
20
20
-
gleam_stdlib,
21
21
-
inets,
22
22
-
midas,
23
23
-
simple_json,
24
24
-
ssl]},
25
25
-
{description, "It's very cool"},
26
26
-
{modules, [main]},
27
27
-
{registered, []}
28
28
-
]}.
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
expression: "./cases/erlang_bug_752"
4
4
-
---
5
5
-
//// /out/lib/the_package/_gleam_artefacts/one.cache
6
6
-
<.cache binary>
7
7
-
8
8
-
//// /out/lib/the_package/_gleam_artefacts/one.cache_meta
9
9
-
<57 byte binary>
10
10
-
11
11
-
//// /out/lib/the_package/_gleam_artefacts/one.erl
12
12
-
-module(one).
13
13
-
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
14
14
-
15
15
-
-export_type([one/1]).
16
16
-
17
17
-
-type one(I) :: {one, I}.
18
18
-
19
19
-
20
20
-
21
21
-
22
22
-
//// /out/lib/the_package/_gleam_artefacts/two.cache
23
23
-
<.cache binary>
24
24
-
25
25
-
//// /out/lib/the_package/_gleam_artefacts/two.cache_meta
26
26
-
<84 byte binary>
27
27
-
28
28
-
//// /out/lib/the_package/_gleam_artefacts/two.erl
29
29
-
-module(two).
30
30
-
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
31
31
-
32
32
-
-export_type([two/1]).
33
33
-
34
34
-
-type two(K) :: {two, one:one(integer())} | {gleam_phantom, K}.
35
35
-
36
36
-
37
37
-
38
38
-
39
39
-
//// /out/lib/the_package/ebin/importy.app
40
40
-
{application, importy, [
41
41
-
{vsn, "0.1.0"},
42
42
-
{applications, []},
43
43
-
{description, ""},
44
44
-
{modules, [one,
45
45
-
two]},
46
46
-
{registered, []}
47
47
-
]}.
48
48
-
49
49
-
50
50
-
//// /out/lib/the_package/include/two_Two.hrl
51
51
-
-record(two, {thing :: one:one(integer())}).
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
expression: "./cases/erlang_empty"
4
4
-
---
5
5
-
//// /out/lib/the_package/_gleam_artefacts/empty.cache
6
6
-
<.cache binary>
7
7
-
8
8
-
//// /out/lib/the_package/_gleam_artefacts/empty.cache_meta
9
9
-
<49 byte binary>
10
10
-
11
11
-
//// /out/lib/the_package/_gleam_artefacts/empty.erl
12
12
-
-module(empty).
13
13
-
14
14
-
15
15
-
//// /out/lib/the_package/ebin/hello_joe.app
16
16
-
{application, hello_joe, [
17
17
-
{vsn, "0.1.0"},
18
18
-
{applications, []},
19
19
-
{description, ""},
20
20
-
{modules, [empty]},
21
21
-
{registered, []}
22
22
-
]}.
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 63
4
4
-
expression: "./cases/erlang_escape_names"
5
5
-
---
6
6
-
//// /out/lib/the_package/_gleam_artefacts/one.cache
7
7
-
<.cache binary>
8
8
-
9
9
-
//// /out/lib/the_package/_gleam_artefacts/one.cache_meta
10
10
-
<61 byte binary>
11
11
-
12
12
-
//// /out/lib/the_package/_gleam_artefacts/one.erl
13
13
-
-module(one).
14
14
-
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
15
15
-
16
16
-
-export(['receive'/1]).
17
17
-
18
18
-
-file("src/one.gleam", 2).
19
19
-
-spec 'receive'(I) -> I.
20
20
-
'receive'(X) ->
21
21
-
X.
22
22
-
23
23
-
24
24
-
//// /out/lib/the_package/_gleam_artefacts/two.cache
25
25
-
<.cache binary>
26
26
-
27
27
-
//// /out/lib/the_package/_gleam_artefacts/two.cache_meta
28
28
-
<136 byte binary>
29
29
-
30
30
-
//// /out/lib/the_package/_gleam_artefacts/two.erl
31
31
-
-module(two).
32
32
-
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
33
33
-
34
34
-
-export([qualified_call/0, qualified_value/0, unqualified_call/0, unqualified_value/0]).
35
35
-
36
36
-
-file("src/two.gleam", 4).
37
37
-
-spec qualified_call() -> integer().
38
38
-
qualified_call() ->
39
39
-
one:'receive'(1).
40
40
-
41
41
-
-file("src/two.gleam", 8).
42
42
-
-spec qualified_value() -> fun((Q) -> Q).
43
43
-
qualified_value() ->
44
44
-
fun one:'receive'/1.
45
45
-
46
46
-
-file("src/two.gleam", 12).
47
47
-
-spec unqualified_call() -> integer().
48
48
-
unqualified_call() ->
49
49
-
one:'receive'(1).
50
50
-
51
51
-
-file("src/two.gleam", 16).
52
52
-
-spec unqualified_value() -> fun((S) -> S).
53
53
-
unqualified_value() ->
54
54
-
fun one:'receive'/1.
55
55
-
56
56
-
57
57
-
//// /out/lib/the_package/ebin/importy.app
58
58
-
{application, importy, [
59
59
-
{vsn, "0.1.0"},
60
60
-
{applications, []},
61
61
-
{description, ""},
62
62
-
{modules, [one,
63
63
-
two]},
64
64
-
{registered, []}
65
65
-
]}.
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 74
4
4
-
expression: "./cases/erlang_import"
5
5
-
---
6
6
-
//// /out/lib/the_package/_gleam_artefacts/one.cache
7
7
-
<.cache binary>
8
8
-
9
9
-
//// /out/lib/the_package/_gleam_artefacts/one.cache_meta
10
10
-
<88 byte binary>
11
11
-
12
12
-
//// /out/lib/the_package/_gleam_artefacts/one.erl
13
13
-
-module(one).
14
14
-
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
15
15
-
16
16
-
-export([unbox/1]).
17
17
-
18
18
-
-file("src/one.gleam", 3).
19
19
-
-spec unbox(two:box()) -> integer().
20
20
-
unbox(X) ->
21
21
-
{box, I} = X,
22
22
-
I.
23
23
-
24
24
-
25
25
-
//// /out/lib/the_package/_gleam_artefacts/two.cache
26
26
-
<.cache binary>
27
27
-
28
28
-
//// /out/lib/the_package/_gleam_artefacts/two.cache_meta
29
29
-
<57 byte binary>
30
30
-
31
31
-
//// /out/lib/the_package/_gleam_artefacts/two.erl
32
32
-
-module(two).
33
33
-
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
34
34
-
35
35
-
-export_type([box/0]).
36
36
-
37
37
-
-type box() :: {box, integer()}.
38
38
-
39
39
-
40
40
-
41
41
-
42
42
-
//// /out/lib/the_package/ebin/importy.app
43
43
-
{application, importy, [
44
44
-
{vsn, "0.1.0"},
45
45
-
{applications, []},
46
46
-
{description, ""},
47
47
-
{modules, [one,
48
48
-
two]},
49
49
-
{registered, []}
50
50
-
]}.
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 85
4
4
-
expression: "./cases/erlang_import_shadowing_prelude"
5
5
-
---
6
6
-
//// /out/lib/the_package/_gleam_artefacts/one.cache
7
7
-
<.cache binary>
8
8
-
9
9
-
//// /out/lib/the_package/_gleam_artefacts/one.cache_meta
10
10
-
<61 byte binary>
11
11
-
12
12
-
//// /out/lib/the_package/_gleam_artefacts/one.erl
13
13
-
-module(one).
14
14
-
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
15
15
-
16
16
-
-export_type([error/0]).
17
17
-
18
18
-
-type error() :: error.
19
19
-
20
20
-
21
21
-
22
22
-
23
23
-
//// /out/lib/the_package/_gleam_artefacts/two.cache
24
24
-
<.cache binary>
25
25
-
26
26
-
//// /out/lib/the_package/_gleam_artefacts/two.cache_meta
27
27
-
<88 byte binary>
28
28
-
29
29
-
//// /out/lib/the_package/_gleam_artefacts/two.erl
30
30
-
-module(two).
31
31
-
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
32
32
-
33
33
-
-export([main/0]).
34
34
-
35
35
-
-file("src/two.gleam", 4).
36
36
-
-spec main() -> one:error().
37
37
-
main() ->
38
38
-
error.
39
39
-
40
40
-
41
41
-
//// /out/lib/the_package/ebin/importy.app
42
42
-
{application, importy, [
43
43
-
{vsn, "0.1.0"},
44
44
-
{applications, []},
45
45
-
{description, ""},
46
46
-
{modules, [one,
47
47
-
two]},
48
48
-
{registered, []}
49
49
-
]}.
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 96
4
4
-
expression: "./cases/erlang_nested"
5
5
-
---
6
6
-
//// /out/lib/the_package/_gleam_artefacts/one@two.cache
7
7
-
<.cache binary>
8
8
-
9
9
-
//// /out/lib/the_package/_gleam_artefacts/one@two.cache_meta
10
10
-
<57 byte binary>
11
11
-
12
12
-
//// /out/lib/the_package/_gleam_artefacts/one@two.erl
13
13
-
-module(one@two).
14
14
-
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
15
15
-
16
16
-
-export([main/0]).
17
17
-
18
18
-
-file("src/one/two.gleam", 1).
19
19
-
-spec main() -> binary().
20
20
-
main() ->
21
21
-
<<"Hi there"/utf8>>.
22
22
-
23
23
-
24
24
-
//// /out/lib/the_package/ebin/importy.app
25
25
-
{application, importy, [
26
26
-
{vsn, "0.1.0"},
27
27
-
{applications, []},
28
28
-
{description, ""},
29
29
-
{modules, [one@two]},
30
30
-
{registered, []}
31
31
-
]}.
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
expression: "./cases/erlang_nested_qualified_constant"
4
4
-
---
5
5
-
//// /out/lib/the_package/_gleam_artefacts/one@two.cache
6
6
-
<.cache binary>
7
7
-
8
8
-
//// /out/lib/the_package/_gleam_artefacts/one@two.cache_meta
9
9
-
<57 byte binary>
10
10
-
11
11
-
//// /out/lib/the_package/_gleam_artefacts/one@two.erl
12
12
-
-module(one@two).
13
13
-
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
14
14
-
15
15
-
-export_type([a/0]).
16
16
-
17
17
-
-type a() :: a.
18
18
-
19
19
-
20
20
-
21
21
-
22
22
-
//// /out/lib/the_package/_gleam_artefacts/two.cache
23
23
-
<.cache binary>
24
24
-
25
25
-
//// /out/lib/the_package/_gleam_artefacts/two.cache_meta
26
26
-
<100 byte binary>
27
27
-
28
28
-
//// /out/lib/the_package/_gleam_artefacts/two.erl
29
29
-
-module(two).
30
30
-
31
31
-
32
32
-
//// /out/lib/the_package/ebin/importy.app
33
33
-
{application, importy, [
34
34
-
{vsn, "0.1.0"},
35
35
-
{applications, []},
36
36
-
{description, ""},
37
37
-
{modules, [one@two,
38
38
-
two]},
39
39
-
{registered, []}
40
40
-
]}.
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 118
4
4
-
expression: "./cases/hello_joe"
5
5
-
---
6
6
-
//// /out/lib/the_package/_gleam_artefacts/hello_joe.cache
7
7
-
<.cache binary>
8
8
-
9
9
-
//// /out/lib/the_package/_gleam_artefacts/hello_joe.cache_meta
10
10
-
<57 byte binary>
11
11
-
12
12
-
//// /out/lib/the_package/_gleam_artefacts/hello_joe.erl
13
13
-
-module(hello_joe).
14
14
-
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
15
15
-
16
16
-
-export([main/0]).
17
17
-
18
18
-
-file("src/hello_joe.gleam", 1).
19
19
-
-spec main() -> binary().
20
20
-
main() ->
21
21
-
<<"Hello, Joe!"/utf8>>.
22
22
-
23
23
-
24
24
-
//// /out/lib/the_package/ebin/hello_joe.app
25
25
-
{application, hello_joe, [
26
26
-
{vsn, "0.1.0"},
27
27
-
{applications, []},
28
28
-
{description, ""},
29
29
-
{modules, [hello_joe]},
30
30
-
{registered, []}
31
31
-
]}.
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
expression: "./cases/import_cycle"
4
4
-
---
5
5
-
error: Import cycle
6
6
-
┌─ src/one.gleam:1:1
7
7
-
│
8
8
-
1 │ import one
9
9
-
│ ^ Imported here
10
10
-
11
11
-
The import statements for these modules form a cycle:
12
12
-
13
13
-
┌─────┐
14
14
-
│ one
15
15
-
└─────┘
16
16
-
Gleam doesn't support dependency cycles like these, please break the
17
17
-
cycle to continue.
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
expression: "./cases/import_cycle_multi"
4
4
-
---
5
5
-
error: Import cycle
6
6
-
┌─ src/three.gleam:1:1
7
7
-
│
8
8
-
1 │ import one
9
9
-
│ ^ Imported here
10
10
-
│
11
11
-
┌─ src/two.gleam:1:1
12
12
-
│
13
13
-
1 │ import three
14
14
-
│ ^ Imported here
15
15
-
│
16
16
-
┌─ src/one.gleam:1:1
17
17
-
│
18
18
-
1 │ import two
19
19
-
│ ^ Imported here
20
20
-
21
21
-
The import statements for these modules form a cycle:
22
22
-
23
23
-
┌─────┐
24
24
-
│ three
25
25
-
│ ↓
26
26
-
│ two
27
27
-
│ ↓
28
28
-
│ one
29
29
-
└─────┘
30
30
-
Gleam doesn't support dependency cycles like these, please break the
31
31
-
cycle to continue.
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 151
4
4
-
expression: "./cases/import_shadowed_name_warning"
5
5
-
---
6
6
-
//// /out/lib/the_package/_gleam_artefacts/one.cache
7
7
-
<.cache binary>
8
8
-
9
9
-
//// /out/lib/the_package/_gleam_artefacts/one.cache_meta
10
10
-
<57 byte binary>
11
11
-
12
12
-
//// /out/lib/the_package/_gleam_artefacts/one.erl
13
13
-
-module(one).
14
14
-
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
15
15
-
16
16
-
-export_type([port_/0]).
17
17
-
18
18
-
-type port_() :: any().
19
19
-
20
20
-
21
21
-
22
22
-
23
23
-
//// /out/lib/the_package/_gleam_artefacts/two.cache
24
24
-
<.cache binary>
25
25
-
26
26
-
//// /out/lib/the_package/_gleam_artefacts/two.cache_meta
27
27
-
<120 byte binary>
28
28
-
29
29
-
//// /out/lib/the_package/_gleam_artefacts/two.erl
30
30
-
-module(two).
31
31
-
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
32
32
-
33
33
-
-export([use_type/1]).
34
34
-
-export_type([shadowing/0]).
35
35
-
36
36
-
-type shadowing() :: port.
37
37
-
38
38
-
-file("src/two.gleam", 14).
39
39
-
-spec use_type(one:port_()) -> nil.
40
40
-
use_type(Port) ->
41
41
-
wibble:wobble(Port).
42
42
-
43
43
-
44
44
-
//// /out/lib/the_package/ebin/importy.app
45
45
-
{application, importy, [
46
46
-
{vsn, "0.1.0"},
47
47
-
{applications, []},
48
48
-
{description, ""},
49
49
-
{modules, [one,
50
50
-
two]},
51
51
-
{registered, []}
52
52
-
]}.
53
53
-
54
54
-
55
55
-
//// Warning
56
56
-
warning: Unused private constructor
57
57
-
┌─ src/two.gleam:9:3
58
58
-
│
59
59
-
9 │ Port
60
60
-
│ ^ This private constructor is never used
61
61
-
62
62
-
Hint: You can safely remove it.
63
63
-
64
64
-
65
65
-
66
66
-
//// Warning
67
67
-
warning: Unused private type
68
68
-
┌─ src/two.gleam:7:1
69
69
-
│
70
70
-
7 │ type Shadowing {
71
71
-
│ ^ This private type is never used
72
72
-
73
73
-
Hint: You can safely remove it.
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 162
4
4
-
expression: "./cases/imported_constants"
5
5
-
---
6
6
-
//// /out/lib/the_package/_gleam_artefacts/one.cache
7
7
-
<.cache binary>
8
8
-
9
9
-
//// /out/lib/the_package/_gleam_artefacts/one.cache_meta
10
10
-
<89 byte binary>
11
11
-
12
12
-
//// /out/lib/the_package/_gleam_artefacts/one.erl
13
13
-
-module(one).
14
14
-
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
15
15
-
16
16
-
-export_type([a/0, b/0, user/0]).
17
17
-
18
18
-
-type a() :: a.
19
19
-
20
20
-
-type b() :: {b, a(), a()}.
21
21
-
22
22
-
-type user() :: {user, binary(), integer()}.
23
23
-
24
24
-
25
25
-
26
26
-
27
27
-
//// /out/lib/the_package/_gleam_artefacts/two.cache
28
28
-
<.cache binary>
29
29
-
30
30
-
//// /out/lib/the_package/_gleam_artefacts/two.cache_meta
31
31
-
<324 byte binary>
32
32
-
33
33
-
//// /out/lib/the_package/_gleam_artefacts/two.erl
34
34
-
-module(two).
35
35
-
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
36
36
-
37
37
-
-export([accessors/1, destructure_qualified/1, destructure_unqualified/1, destructure_aliased/1, qualified_fn_a/0, qualified_fn_b/0, unqualified_fn_a/0, unqualified_fn_b/0, aliased_fn_a/0, aliased_fn_b/0]).
38
38
-
39
39
-
-file("src/two.gleam", 45).
40
40
-
-spec accessors(one:user()) -> {binary(), integer()}.
41
41
-
accessors(User) ->
42
42
-
Name = erlang:element(2, User),
43
43
-
Score = erlang:element(3, User),
44
44
-
{Name, Score}.
45
45
-
46
46
-
-file("src/two.gleam", 52).
47
47
-
-spec destructure_qualified(one:user()) -> {binary(), integer()}.
48
48
-
destructure_qualified(User) ->
49
49
-
{user, Name, Score} = User,
50
50
-
{Name, Score}.
51
51
-
52
52
-
-file("src/two.gleam", 57).
53
53
-
-spec destructure_unqualified(one:user()) -> {binary(), integer()}.
54
54
-
destructure_unqualified(User) ->
55
55
-
{user, Name, Score} = User,
56
56
-
{Name, Score}.
57
57
-
58
58
-
-file("src/two.gleam", 62).
59
59
-
-spec destructure_aliased(one:user()) -> {binary(), integer()}.
60
60
-
destructure_aliased(User) ->
61
61
-
{user, Name, Score} = User,
62
62
-
{Name, Score}.
63
63
-
64
64
-
-file("src/two.gleam", 6).
65
65
-
-spec qualified_fn_a() -> one:a().
66
66
-
qualified_fn_a() ->
67
67
-
a.
68
68
-
69
69
-
-file("src/two.gleam", 12).
70
70
-
-spec qualified_fn_b() -> one:b().
71
71
-
qualified_fn_b() ->
72
72
-
{b, a, a}.
73
73
-
74
74
-
-file("src/two.gleam", 19).
75
75
-
-spec unqualified_fn_a() -> one:a().
76
76
-
unqualified_fn_a() ->
77
77
-
a.
78
78
-
79
79
-
-file("src/two.gleam", 25).
80
80
-
-spec unqualified_fn_b() -> one:b().
81
81
-
unqualified_fn_b() ->
82
82
-
{b, a, a}.
83
83
-
84
84
-
-file("src/two.gleam", 33).
85
85
-
-spec aliased_fn_a() -> one:a().
86
86
-
aliased_fn_a() ->
87
87
-
a.
88
88
-
89
89
-
-file("src/two.gleam", 39).
90
90
-
-spec aliased_fn_b() -> one:b().
91
91
-
aliased_fn_b() ->
92
92
-
{b, a, a}.
93
93
-
94
94
-
95
95
-
//// /out/lib/the_package/ebin/importy.app
96
96
-
{application, importy, [
97
97
-
{vsn, "0.1.0"},
98
98
-
{applications, []},
99
99
-
{description, ""},
100
100
-
{modules, [one,
101
101
-
two]},
102
102
-
{registered, []}
103
103
-
]}.
104
104
-
105
105
-
106
106
-
//// /out/lib/the_package/include/one_User.hrl
107
107
-
-record(user, {name :: binary(), score :: integer()}).
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 173
4
4
-
expression: "./cases/imported_external_fns"
5
5
-
---
6
6
-
//// /out/lib/the_package/_gleam_artefacts/one.cache
7
7
-
<.cache binary>
8
8
-
9
9
-
//// /out/lib/the_package/_gleam_artefacts/one.cache_meta
10
10
-
<53 byte binary>
11
11
-
12
12
-
//// /out/lib/the_package/_gleam_artefacts/one.erl
13
13
-
-module(one).
14
14
-
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
15
15
-
16
16
-
-export([thing/0]).
17
17
-
18
18
-
-file("src/one.gleam", 2).
19
19
-
-spec thing() -> nil.
20
20
-
thing() ->
21
21
-
thing:new().
22
22
-
23
23
-
24
24
-
//// /out/lib/the_package/_gleam_artefacts/two.cache
25
25
-
<.cache binary>
26
26
-
27
27
-
//// /out/lib/the_package/_gleam_artefacts/two.cache_meta
28
28
-
<319 byte binary>
29
29
-
30
30
-
//// /out/lib/the_package/_gleam_artefacts/two.erl
31
31
-
-module(two).
32
32
-
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
33
33
-
34
34
-
-export([fn_reference_qualified/0, fn_reference_qualified_aliased/0, fn_reference_unqualified/0, fn_reference_unqualified_aliased/0, fn_call_qualified/0, fn_call_qualified_aliased/0, fn_call_unqualified/0, fn_call_unqualified_aliased/0, the_consts/0]).
35
35
-
36
36
-
-file("src/two.gleam", 27).
37
37
-
-spec fn_reference_qualified() -> fun(() -> nil).
38
38
-
fn_reference_qualified() ->
39
39
-
fun thing:new/0.
40
40
-
41
41
-
-file("src/two.gleam", 31).
42
42
-
-spec fn_reference_qualified_aliased() -> fun(() -> nil).
43
43
-
fn_reference_qualified_aliased() ->
44
44
-
fun thing:new/0.
45
45
-
46
46
-
-file("src/two.gleam", 35).
47
47
-
-spec fn_reference_unqualified() -> fun(() -> nil).
48
48
-
fn_reference_unqualified() ->
49
49
-
fun thing:new/0.
50
50
-
51
51
-
-file("src/two.gleam", 39).
52
52
-
-spec fn_reference_unqualified_aliased() -> fun(() -> nil).
53
53
-
fn_reference_unqualified_aliased() ->
54
54
-
fun thing:new/0.
55
55
-
56
56
-
-file("src/two.gleam", 45).
57
57
-
-spec fn_call_qualified() -> nil.
58
58
-
fn_call_qualified() ->
59
59
-
thing:new().
60
60
-
61
61
-
-file("src/two.gleam", 49).
62
62
-
-spec fn_call_qualified_aliased() -> nil.
63
63
-
fn_call_qualified_aliased() ->
64
64
-
thing:new().
65
65
-
66
66
-
-file("src/two.gleam", 53).
67
67
-
-spec fn_call_unqualified() -> nil.
68
68
-
fn_call_unqualified() ->
69
69
-
thing:new().
70
70
-
71
71
-
-file("src/two.gleam", 57).
72
72
-
-spec fn_call_unqualified_aliased() -> nil.
73
73
-
fn_call_unqualified_aliased() ->
74
74
-
thing:new().
75
75
-
76
76
-
-file("src/two.gleam", 14).
77
77
-
-spec the_consts() -> nil.
78
78
-
the_consts() ->
79
79
-
_ = fun thing:new/0,
80
80
-
_ = fun thing:new/0,
81
81
-
_ = fun thing:new/0,
82
82
-
_ = fun thing:new/0,
83
83
-
thing:new(),
84
84
-
thing:new(),
85
85
-
thing:new(),
86
86
-
thing:new().
87
87
-
88
88
-
89
89
-
//// /out/lib/the_package/ebin/importy.app
90
90
-
{application, importy, [
91
91
-
{vsn, "0.1.0"},
92
92
-
{applications, []},
93
93
-
{description, ""},
94
94
-
{modules, [one,
95
95
-
two]},
96
96
-
{registered, []}
97
97
-
]}.
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 184
4
4
-
expression: "./cases/imported_record_constructors"
5
5
-
---
6
6
-
//// /out/lib/the_package/_gleam_artefacts/one@one.cache
7
7
-
<.cache binary>
8
8
-
9
9
-
//// /out/lib/the_package/_gleam_artefacts/one@one.cache_meta
10
10
-
<89 byte binary>
11
11
-
12
12
-
//// /out/lib/the_package/_gleam_artefacts/one@one.erl
13
13
-
-module(one@one).
14
14
-
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
15
15
-
16
16
-
-export_type([a/0, b/0, user/0]).
17
17
-
18
18
-
-type a() :: a.
19
19
-
20
20
-
-type b() :: {b, a(), a()}.
21
21
-
22
22
-
-type user() :: {user, binary(), integer()}.
23
23
-
24
24
-
25
25
-
26
26
-
27
27
-
//// /out/lib/the_package/_gleam_artefacts/two.cache
28
28
-
<.cache binary>
29
29
-
30
30
-
//// /out/lib/the_package/_gleam_artefacts/two.cache_meta
31
31
-
<491 byte binary>
32
32
-
33
33
-
//// /out/lib/the_package/_gleam_artefacts/two.erl
34
34
-
-module(two).
35
35
-
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
36
36
-
37
37
-
-export([accessors/1, destructure_qualified/1, destructure_qualified_aliased/1, destructure_unqualified/1, destructure_aliased/1, update_qualified/1, update_qualified_aliased/1, update_unqualified/1, update_aliased/1, qualified_fn_a/0, qualified_fn_b/0, qualified_aliased_fn_a/0, qualified_aliased_fn_b/0, unqualified_fn_a/0, unqualified_fn_b/0, aliased_fn_a/0, aliased_fn_b/0]).
38
38
-
39
39
-
-file("src/two.gleam", 58).
40
40
-
-spec accessors(one@one:user()) -> {binary(), integer()}.
41
41
-
accessors(User) ->
42
42
-
Name = erlang:element(2, User),
43
43
-
Score = erlang:element(3, User),
44
44
-
{Name, Score}.
45
45
-
46
46
-
-file("src/two.gleam", 65).
47
47
-
-spec destructure_qualified(one@one:user()) -> {binary(), integer()}.
48
48
-
destructure_qualified(User) ->
49
49
-
{user, Name, Score} = User,
50
50
-
{Name, Score}.
51
51
-
52
52
-
-file("src/two.gleam", 70).
53
53
-
-spec destructure_qualified_aliased(one@one:user()) -> {binary(), integer()}.
54
54
-
destructure_qualified_aliased(User) ->
55
55
-
{user, Name, Score} = User,
56
56
-
{Name, Score}.
57
57
-
58
58
-
-file("src/two.gleam", 75).
59
59
-
-spec destructure_unqualified(one@one:user()) -> {binary(), integer()}.
60
60
-
destructure_unqualified(User) ->
61
61
-
{user, Name, Score} = User,
62
62
-
{Name, Score}.
63
63
-
64
64
-
-file("src/two.gleam", 80).
65
65
-
-spec destructure_aliased(one@one:user()) -> {binary(), integer()}.
66
66
-
destructure_aliased(User) ->
67
67
-
{user, Name, Score} = User,
68
68
-
{Name, Score}.
69
69
-
70
70
-
-file("src/two.gleam", 86).
71
71
-
-spec update_qualified(one@one:user()) -> one@one:user().
72
72
-
update_qualified(User) ->
73
73
-
erlang:setelement(2, User, <<"wibble"/utf8>>).
74
74
-
75
75
-
-file("src/two.gleam", 90).
76
76
-
-spec update_qualified_aliased(one@one:user()) -> one@one:user().
77
77
-
update_qualified_aliased(User) ->
78
78
-
erlang:setelement(2, User, <<"wibble"/utf8>>).
79
79
-
80
80
-
-file("src/two.gleam", 94).
81
81
-
-spec update_unqualified(one@one:user()) -> one@one:user().
82
82
-
update_unqualified(User) ->
83
83
-
erlang:setelement(2, User, <<"wibble"/utf8>>).
84
84
-
85
85
-
-file("src/two.gleam", 98).
86
86
-
-spec update_aliased(one@one:user()) -> one@one:user().
87
87
-
update_aliased(User) ->
88
88
-
erlang:setelement(2, User, <<"wibble"/utf8>>).
89
89
-
90
90
-
-file("src/two.gleam", 7).
91
91
-
-spec qualified_fn_a() -> one@one:a().
92
92
-
qualified_fn_a() ->
93
93
-
a.
94
94
-
95
95
-
-file("src/two.gleam", 13).
96
96
-
-spec qualified_fn_b() -> one@one:b().
97
97
-
qualified_fn_b() ->
98
98
-
{b, a, a}.
99
99
-
100
100
-
-file("src/two.gleam", 19).
101
101
-
-spec qualified_aliased_fn_a() -> one@one:a().
102
102
-
qualified_aliased_fn_a() ->
103
103
-
a.
104
104
-
105
105
-
-file("src/two.gleam", 25).
106
106
-
-spec qualified_aliased_fn_b() -> one@one:b().
107
107
-
qualified_aliased_fn_b() ->
108
108
-
{b, a, a}.
109
109
-
110
110
-
-file("src/two.gleam", 32).
111
111
-
-spec unqualified_fn_a() -> one@one:a().
112
112
-
unqualified_fn_a() ->
113
113
-
a.
114
114
-
115
115
-
-file("src/two.gleam", 38).
116
116
-
-spec unqualified_fn_b() -> one@one:b().
117
117
-
unqualified_fn_b() ->
118
118
-
{b, a, a}.
119
119
-
120
120
-
-file("src/two.gleam", 46).
121
121
-
-spec aliased_fn_a() -> one@one:a().
122
122
-
aliased_fn_a() ->
123
123
-
a.
124
124
-
125
125
-
-file("src/two.gleam", 52).
126
126
-
-spec aliased_fn_b() -> one@one:b().
127
127
-
aliased_fn_b() ->
128
128
-
{b, a, a}.
129
129
-
130
130
-
131
131
-
//// /out/lib/the_package/ebin/importy.app
132
132
-
{application, importy, [
133
133
-
{vsn, "0.1.0"},
134
134
-
{applications, []},
135
135
-
{description, ""},
136
136
-
{modules, [one@one,
137
137
-
two]},
138
138
-
{registered, []}
139
139
-
]}.
140
140
-
141
141
-
142
142
-
//// /out/lib/the_package/include/one@one_User.hrl
143
143
-
-record(user, {name :: binary(), score :: integer()}).
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
expression: "./cases/javascript_d_ts"
4
4
-
---
5
5
-
//// /out/lib/the_package/_gleam_artefacts/hello.cache
6
6
-
<.cache binary>
7
7
-
8
8
-
//// /out/lib/the_package/_gleam_artefacts/hello.cache_meta
9
9
-
<73 byte binary>
10
10
-
11
11
-
//// /out/lib/the_package/gleam.d.mts
12
12
-
export * from "../prelude.mjs";
13
13
-
export type * from "../prelude.d.mts";
14
14
-
15
15
-
16
16
-
//// /out/lib/the_package/gleam.mjs
17
17
-
export * from "../prelude.mjs";
18
18
-
19
19
-
20
20
-
//// /out/lib/the_package/hello.d.mts
21
21
-
import type * as _ from "./gleam.d.mts";
22
22
-
23
23
-
export class Woo extends _.CustomType {}
24
24
-
25
25
-
export type Wibble$ = Woo;
26
26
-
27
27
-
export function wobble(): Wibble$;
28
28
-
29
29
-
30
30
-
//// /out/lib/the_package/hello.mjs
31
31
-
/// <reference types="./hello.d.mts" />
32
32
-
import { CustomType as $CustomType } from "./gleam.mjs";
33
33
-
34
34
-
export class Woo extends $CustomType {}
35
35
-
36
36
-
export function wobble() {
37
37
-
return new Woo();
38
38
-
}
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
expression: "./cases/javascript_empty"
4
4
-
---
5
5
-
//// /out/lib/the_package/_gleam_artefacts/empty.cache
6
6
-
<.cache binary>
7
7
-
8
8
-
//// /out/lib/the_package/_gleam_artefacts/empty.cache_meta
9
9
-
<49 byte binary>
10
10
-
11
11
-
//// /out/lib/the_package/empty.mjs
12
12
-
export {}
13
13
-
14
14
-
15
15
-
//// /out/lib/the_package/gleam.mjs
16
16
-
export * from "../prelude.mjs";
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
expression: "./cases/javascript_import"
4
4
-
---
5
5
-
//// /out/lib/the_package/_gleam_artefacts/one@two.cache
6
6
-
<.cache binary>
7
7
-
8
8
-
//// /out/lib/the_package/_gleam_artefacts/one@two.cache_meta
9
9
-
<57 byte binary>
10
10
-
11
11
-
//// /out/lib/the_package/_gleam_artefacts/two.cache
12
12
-
<.cache binary>
13
13
-
14
14
-
//// /out/lib/the_package/_gleam_artefacts/two.cache_meta
15
15
-
<80 byte binary>
16
16
-
17
17
-
//// /out/lib/the_package/gleam.d.mts
18
18
-
export * from "../prelude.mjs";
19
19
-
export type * from "../prelude.d.mts";
20
20
-
21
21
-
22
22
-
//// /out/lib/the_package/gleam.mjs
23
23
-
export * from "../prelude.mjs";
24
24
-
25
25
-
26
26
-
//// /out/lib/the_package/one/two.d.mts
27
27
-
import type * as _ from "../gleam.d.mts";
28
28
-
29
29
-
export class A extends _.CustomType {}
30
30
-
31
31
-
export type A$ = A;
32
32
-
33
33
-
34
34
-
//// /out/lib/the_package/one/two.mjs
35
35
-
/// <reference types="./two.d.mts" />
36
36
-
import { CustomType as $CustomType } from "../gleam.mjs";
37
37
-
38
38
-
export class A extends $CustomType {}
39
39
-
40
40
-
41
41
-
//// /out/lib/the_package/two.d.mts
42
42
-
import type * as $two from "./one/two.d.mts";
43
43
-
44
44
-
export const x: $two.A$;
45
45
-
46
46
-
47
47
-
//// /out/lib/the_package/two.mjs
48
48
-
/// <reference types="./two.d.mts" />
49
49
-
import * as $two from "./one/two.mjs";
50
50
-
51
51
-
export const x = /* @__PURE__ */ new $two.A();
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 237
4
4
-
expression: "./cases/not_overwriting_erlang_module"
5
5
-
---
6
6
-
//// /out/lib/the_package/_gleam_artefacts/app@code.cache
7
7
-
<.cache binary>
8
8
-
9
9
-
//// /out/lib/the_package/_gleam_artefacts/app@code.cache_meta
10
10
-
<65 byte binary>
11
11
-
12
12
-
//// /out/lib/the_package/_gleam_artefacts/app@code.erl
13
13
-
-module(app@code).
14
14
-
15
15
-
16
16
-
//// /out/lib/the_package/ebin/importy.app
17
17
-
{application, importy, [
18
18
-
{vsn, "0.1.0"},
19
19
-
{applications, []},
20
20
-
{description, ""},
21
21
-
{modules, [app@code]},
22
22
-
{registered, []}
23
23
-
]}.
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
expression: "./cases/opaque_type_accessor"
4
4
-
---
5
5
-
error: Unknown record field
6
6
-
┌─ src/two.gleam:7:18
7
7
-
│
8
8
-
7 │ let name = user.name
9
9
-
│ ^ This field does not exist
10
10
-
11
11
-
The value being accessed has this type:
12
12
-
13
13
-
User
14
14
-
15
15
-
It does not have any fields.
16
16
-
17
17
-
error: Unknown record field
18
18
-
┌─ src/two.gleam:8:19
19
19
-
│
20
20
-
8 │ let score = user.score
21
21
-
│ ^ This field does not exist
22
22
-
23
23
-
The value being accessed has this type:
24
24
-
25
25
-
User
26
26
-
27
27
-
It does not have any fields.
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 249
4
4
-
expression: "./cases/opaque_type_construct"
5
5
-
---
6
6
-
error: Unknown variable
7
7
-
┌─ src/two.gleam:7:3
8
8
-
│
9
9
-
7 │ User(name: "Alim", score: 10)
10
10
-
│ ^ Did you mean `Error`?
11
11
-
12
12
-
The name `User` is not in scope here.
13
13
-
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
expression: "./cases/opaque_type_destructure"
4
4
-
---
5
5
-
error: Unknown module value
6
6
-
┌─ src/two.gleam:7:7
7
7
-
│
8
8
-
7 │ let one.User(name: name, score: score) = user
9
9
-
│ ^
10
10
-
11
11
-
The module `one` does not have a `User` value.
12
12
-
13
13
-
error: Unknown variable
14
14
-
┌─ src/two.gleam:8:5
15
15
-
│
16
16
-
8 │ #(name, score)
17
17
-
│ ^
18
18
-
19
19
-
The name `name` is not in scope here.
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 273
4
4
-
expression: "./cases/overwriting_erlang_module"
5
5
-
---
6
6
-
error: Erlang module name collision
7
7
-
8
8
-
The module `src/code.gleam` compiles to an Erlang module named `code`.
9
9
-
10
10
-
By default Erlang includes a module with the same name so if we were to
11
11
-
compile and load your module it would overwrite the Erlang one, potentially
12
12
-
causing confusing errors and crashes.
13
13
-
14
14
-
Hint: Rename this module and try again.
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 273
4
4
-
expression: "./cases/src_importing_test"
5
5
-
---
6
6
-
error: App importing test module
7
7
-
┌─ src/one.gleam:3:1
8
8
-
│
9
9
-
3 │ import two
10
10
-
│ ^ Imported here
11
11
-
12
12
-
The application module `one` is importing the test module `two`.
13
13
-
14
14
-
Test modules are not included in production builds so test modules cannot
15
15
-
import them. Perhaps move the `two` module to the src directory.
16
16
-
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
expression: "./cases/unknown_module_field_in_constant"
4
4
-
---
5
5
-
error: Unknown module value
6
6
-
┌─ src/two.gleam:3:16
7
7
-
│
8
8
-
3 │ pub const it = one.B
9
9
-
│ ^ Did you mean `A`?
10
10
-
11
11
-
The module `one` does not have a `B` value.
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
expression: "./cases/unknown_module_field_in_expression"
4
4
-
---
5
5
-
error: Unknown module value
6
6
-
┌─ src/two.gleam:4:6
7
7
-
│
8
8
-
4 │ one.B
9
9
-
│ ^ Did you mean `A`?
10
10
-
11
11
-
The module `one` does not have a `B` value.
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
expression: "./cases/unknown_module_field_in_import"
4
4
-
---
5
5
-
error: Unknown module value
6
6
-
┌─ src/two.gleam:1:13
7
7
-
│
8
8
-
1 │ import one.{B}
9
9
-
│ ^ Did you mean `A`?
10
10
-
11
11
-
The module `one` does not have a `B` value.
···
1
1
-
---
2
2
-
source: test-package-compiler/src/generated_tests.rs
3
3
-
assertion_line: 316
4
4
-
expression: "./cases/variable_or_module"
5
5
-
---
6
6
-
//// /out/lib/the_package/_gleam_artefacts/main.cache
7
7
-
<.cache binary>
8
8
-
9
9
-
//// /out/lib/the_package/_gleam_artefacts/main.cache_meta
10
10
-
<118 byte binary>
11
11
-
12
12
-
//// /out/lib/the_package/_gleam_artefacts/main.erl
13
13
-
-module(main).
14
14
-
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
15
15
-
16
16
-
-export([module_function/1, record_field/1]).
17
17
-
18
18
-
-file("src/main.gleam", 4).
19
19
-
-spec module_function(power:power()) -> integer().
20
20
-
module_function(Power) ->
21
21
-
power:to_int(Power).
22
22
-
23
23
-
-file("src/main.gleam", 10).
24
24
-
-spec record_field(power:power()) -> integer().
25
25
-
record_field(Power) ->
26
26
-
erlang:element(2, Power).
27
27
-
28
28
-
29
29
-
//// /out/lib/the_package/_gleam_artefacts/power.cache
30
30
-
<.cache binary>
31
31
-
32
32
-
//// /out/lib/the_package/_gleam_artefacts/power.cache_meta
33
33
-
<77 byte binary>
34
34
-
35
35
-
//// /out/lib/the_package/_gleam_artefacts/power.erl
36
36
-
-module(power).
37
37
-
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
38
38
-
39
39
-
-export([to_int/1]).
40
40
-
-export_type([power/0]).
41
41
-
42
42
-
-type power() :: {power, integer()}.
43
43
-
44
44
-
-file("src/power.gleam", 6).
45
45
-
-spec to_int(power()) -> integer().
46
46
-
to_int(P) ->
47
47
-
erlang:element(2, P) * 9000.
48
48
-
49
49
-
50
50
-
//// /out/lib/the_package/ebin/importy.app
51
51
-
{application, importy, [
52
52
-
{vsn, "0.1.0"},
53
53
-
{applications, []},
54
54
-
{description, ""},
55
55
-
{modules, [main,
56
56
-
power]},
57
57
-
{registered, []}
58
58
-
]}.
59
59
-
60
60
-
61
61
-
//// /out/lib/the_package/include/power_Power.hrl
62
62
-
-record(power, {value :: integer()}).
···
1
1
---
2
2
source: test-project-compiler/src/generated_tests.rs
3
3
-
assertion_line: 10
4
3
expression: "./cases/with_dep"
5
4
---
6
5
//// with_dep/build/dev/erlang/example/_gleam_artefacts/example@@main.erl
···
1
1
---
2
2
source: test-project-compiler/src/generated_tests.rs
3
3
-
assertion_line: 32
4
3
expression: "./cases/with_dep"
5
4
---
6
5
//// with_dep/build/lsp/erlang/example/_gleam_artefacts/example@@main.erl
···
1
1
---
2
2
source: test-project-compiler/src/generated_tests.rs
3
3
-
assertion_line: 21
4
3
expression: "./cases/with_dep"
5
4
---
6
5
//// with_dep/build/prod/erlang/example/_gleam_artefacts/example@@main.erl
···
1
1
---
2
2
source: test-project-compiler/src/generated_tests.rs
3
3
-
assertion_line: 43
4
3
expression: "./cases/with_dev_dep"
5
4
---
6
5
//// with_dev_dep/build/dev/erlang/example/_gleam_artefacts/example@@main.erl
···
1
1
---
2
2
source: test-project-compiler/src/generated_tests.rs
3
3
-
assertion_line: 65
4
3
expression: "./cases/with_dev_dep"
5
4
---
6
5
//// with_dev_dep/build/lsp/erlang/example/_gleam_artefacts/example@@main.erl
···
1
1
---
2
2
source: test-project-compiler/src/generated_tests.rs
3
3
-
assertion_line: 54
4
3
expression: "./cases/with_dev_dep"
5
4
---
6
5
//// with_dev_dep/build/prod/erlang/example/_gleam_artefacts/example@@main.erl