compiler-core
src
javascript
language_server
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/numbers.rs
3
3
-
expression: "\npub fn main(x) {\n case x {\n 100.001e123_456_789 -> \"bar\"\n _ -> \"foo\"\n }\n}\n"
3
3
+
expression: "\npub fn main(x) {\n case x {\n 100.001e123_456_789 -> \"wobble\"\n _ -> \"wibble\"\n }\n}\n"
4
4
---
5
5
----- SOURCE CODE
6
6
7
7
pub fn main(x) {
8
8
case x {
9
9
-
100.001e123_456_789 -> "bar"
10
10
-
_ -> "foo"
9
9
+
100.001e123_456_789 -> "wobble"
10
10
+
_ -> "wibble"
11
11
}
12
12
}
13
13
···
16
16
error: Float outside of valid range
17
17
┌─ /src/one/two.gleam:4:3
18
18
│
19
19
-
4 │ 100.001e123_456_789 -> "bar"
19
19
+
4 │ 100.001e123_456_789 -> "wobble"
20
20
│ ^^^^^^^^^^^^^^^^^^^
21
21
22
22
This float value is too large to be represented by a floating point type:
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/numbers.rs
3
3
-
expression: "\npub fn main(x) {\n case x {\n 0._1 -> \"bar\"\n _ -> \"foo\"\n }\n}\n"
3
3
+
expression: "\npub fn main(x) {\n case x {\n 0._1 -> \"wobble\"\n _ -> \"wibble\"\n }\n}\n"
4
4
---
5
5
----- SOURCE CODE
6
6
7
7
pub fn main(x) {
8
8
case x {
9
9
-
0._1 -> "bar"
10
10
-
_ -> "foo"
9
9
+
0._1 -> "wobble"
10
10
+
_ -> "wibble"
11
11
}
12
12
}
13
13
···
15
15
----- COMPILED JAVASCRIPT
16
16
export function main(x) {
17
17
if (x === 0.1) {
18
18
-
return "bar";
18
18
+
return "wobble";
19
19
} else {
20
20
-
return "foo";
20
20
+
return "wibble";
21
21
}
22
22
}
···
405
405
#[test]
406
406
fn importable_does_not_add_extra_new_line_if_imports_exist() {
407
407
let dep = "pub fn wobble() {\nNil\n}";
408
408
-
let prefix = "import foo\n\n";
408
408
+
let prefix = "import wibble\n\n";
409
409
let code = "";
410
410
411
411
assert_completion_with_prefix!(
412
412
TestProject::for_source(code)
413
413
.add_module("dep", dep)
414
414
-
.add_module("foo", ""),
414
414
+
.add_module("wibble", ""),
415
415
prefix
416
416
);
417
417
}
···
425
425
assert_completion_with_prefix!(
426
426
TestProject::for_source(code)
427
427
.add_module("dep", dep)
428
428
-
.add_module("foo", ""),
428
428
+
.add_module("wibble", ""),
429
429
prefix
430
430
);
431
431
}
···
972
972
#[test]
973
973
fn local_variable_inside_nested_exprs() {
974
974
let code = r#"
975
975
-
type Foo { Bar(List(#(Bool))) }
975
975
+
type Wibble { Wobble(List(#(Bool))) }
976
976
fn wibble() {
977
977
-
Bar([#(!{
978
978
-
let foo = True
979
979
-
foo
977
977
+
Wobble([#(!{
978
978
+
let wibble = True
979
979
+
wibble
980
980
})])
981
981
todo
982
982
}
···
1
1
---
2
2
source: compiler-core/src/language_server/tests/completion.rs
3
3
-
expression: "\ntype Foo { Bar(List(#(Bool))) }\nfn wibble() {\n Bar([#(!{\n let foo = True\n foo\n })])\n todo\n}\n"
3
3
+
expression: "\ntype Wibble { Wobble(List(#(Bool))) }\nfn wibble() {\n Wobble([#(!{\n let wibble = True\n wibble\n })])\n todo\n}\n"
4
4
---
5
5
-
type Foo { Bar(List(#(Bool))) }
5
5
+
type Wibble { Wobble(List(#(Bool))) }
6
6
fn wibble() {
7
7
-
Bar([#(!{
8
8
-
let foo = True
9
9
-
foo|
7
7
+
Wobble([#(!{
8
8
+
let wibble = True
9
9
+
wib|ble
10
10
})])
11
11
todo
12
12
}
13
13
14
14
15
15
----- Completion content -----
16
16
-
Bar
17
17
-
kind: Constructor
18
18
-
detail: fn(List(#(Bool))) -> Foo
19
19
-
sort: 2_Bar
20
20
-
desc: app
21
21
-
edits:
22
22
-
[5:4-5:4]: "Bar"
23
16
Error
24
17
kind: Constructor
25
18
detail: gleam
···
40
33
kind: EnumMember
41
34
detail: gleam
42
35
sort: 4_True
43
43
-
foo
36
36
+
Wobble
37
37
+
kind: Constructor
38
38
+
detail: fn(List(#(Bool))) -> Wibble
39
39
+
sort: 2_Wobble
40
40
+
desc: app
41
41
+
edits:
42
42
+
[5:4-5:4]: "Wobble"
43
43
+
wibble
44
44
kind: Variable
45
45
detail: Bool
46
46
-
sort: 2_foo
46
46
+
sort: 2_wibble
47
47
desc: app
48
48
docs: "A locally defined variable."
49
49
edits:
50
50
-
[5:4-5:4]: "foo"
50
50
+
[5:4-5:4]: "wibble"
51
51
wibble
52
52
kind: Function
53
53
detail: fn() -> a
···
3111
3111
// "hi"
3112
3112
// True
3113
3113
// [1,2,3]
3114
3114
-
// foo <> "bar"
3114
3114
+
// wibble <> "wobble"
3115
3115
fn parse_const_value(&mut self) -> Result<Option<UntypedConstant>, ParseError> {
3116
3116
let constant_result = self.parse_const_value_unit();
3117
3117
match constant_result {