summaryrefslogtreecommitdiff
path: root/tests/query/highlights/gleam/type.gleam
blob: 08887e021e77e1657079233a7ea051a067d561ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
pub type Cat {
// <- keyword
//  ^ keyword.function
//       ^ type
//           ^ punctuation.bracket
  Cat(name: String, cuteness: Int)
  // <- type
  // ^ punctuation.bracket
  //  ^ property
  //      ^ property
  //        ^ type
  //              ^ punctuation.delimiter
  //                ^ property
  //                        ^ property
  //                          ^ type
  //                             ^ punctuation.bracket
}

fn cats() {
  Cat(name: "Nubi", cuteness: 2001)
  // <- type
  // ^ punctuation.bracket
  //  ^ property
  //      ^ property
  //        ^ string
  //              ^ punctuation.delimiter
  //                ^ property
  //                        ^ property
  //                          ^ number
  Cat("Ginny", 1950)
  // <- type
  // ^ punctuation.bracket
  //  ^ string
  //         ^ punctuation.delimiter
  //           ^ number
  //               ^ punctuation.bracket
}

type Box(inner_type) {
// <- keyword.function
//   ^ type
//      ^ punctuation.bracket
//       ^ parameter
//                 ^ punctuation.bracket
//                   ^ punctuation.bracket
  Box(inner: inner_type)
  // <- type
  // ^ punctuation.bracket
  //  ^ property
  //       ^ property
  //         ^ type
  //                   ^ punctuation.bracket
}

pub opaque type Counter {
// <- keyword
//  ^ keyword
//         ^ keyword.function
//              ^ type
//                      ^ punctuation.bracket
  Counter(value: Int)
}

pub fn have_birthday(person) {
  Person(..person, age: person.age + 1, is_happy: True)
  // <- type
  //    ^ punctuation.bracket
  //     ^ operator
  //       ^ variable
  //             ^ punctuation.delimiter
  //               ^ property
  //                  ^ property
  //                    ^ variable
  //                          ^ punctuation.delimiter
  //                           ^ property
  //                               ^ operator
  //                                 ^ number
  //                                  ^ punctuation.delimiter
  //                                    ^ property
  //                                            ^ property
  //                                              ^ boolean
  //                                                  ^ punctuation.bracket
}