firefly-compiler 0.5.42 → 0.5.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -167,9 +167,12 @@ extend self: Compiler {
167
167
  }
168
168
  try {
169
169
  self.parse(newPackagePair, newModuleName, Some(import.at))
170
- } catch {| CompileError(_, _) @ e, error =>
170
+ } tryCatch {| CompileError(_, _) @ e, error =>
171
171
  let newError = CompileError(import.at, "Parse error in imported module: " + import.package.groupName() + "/" + newModuleName)
172
172
  throw(CompileErrors([e, newError]))
173
+ } catch {| CompileErrors(compileErrors), error =>
174
+ let newError = CompileError(import.at, "Parse errors in imported module: " + import.package.groupName() + "/" + newModuleName)
175
+ throw(CompileErrors([...compileErrors, newError]))
173
176
  }
174
177
  }
175
178
  }
@@ -27,15 +27,22 @@ core(name: String): String {
27
27
  }
28
28
 
29
29
  extend self: Inference {
30
-
30
+
31
31
  inferModule(module: Module, otherModules: List[Module]): Module {
32
32
  let environment = Environment.new(module, otherModules, alreadyFlat = False)
33
33
 
34
- let traits = module.traits.map {self.inferTraitDefinition(environment, _)}
35
- let instances = module.instances.map {self.inferInstanceDefinition(environment, _)}
36
- let lets = module.lets.map {self.inferLetDefinition(environment, _)}
37
- let functions = module.functions.map {self.inferFunctionDefinition(environment, _)}
38
- let extends = module.extends.map {self.inferExtendDefinition(environment, _)}
34
+ let errors = Array.new()
35
+ let traits = catchManyInto(errors, module.traits) {self.inferTraitDefinition(environment, _)}
36
+ let instances = catchManyInto(errors, module.instances) {self.inferInstanceDefinition(environment, _)}
37
+ let lets = catchManyInto(errors, module.lets) {self.inferLetDefinition(environment, _)}
38
+ let functions = catchManyInto(errors, module.functions) {self.inferFunctionDefinition(environment, _)}
39
+ let extends = catchManyInto(errors, module.extends) {self.inferExtendDefinition(environment, _)}
40
+ errors.drain().{
41
+ | [] =>
42
+ | [Pair(_, error)] => error.rethrow()
43
+ | allErrors => throw(CompileErrors(allErrors.map {_.first}))
44
+ }
45
+
39
46
  let result = module.Module(
40
47
  traits = traits
41
48
  instances = instances
@@ -89,7 +96,7 @@ extend self: Inference {
89
96
  }
90
97
 
91
98
  definition.DInstance(
92
- methods = definition.methods.map {instanceFunction =>
99
+ methods = catchMany(definition.methods) {instanceFunction =>
93
100
  let methodName = instanceFunction.signature.name
94
101
  let traitMethodName = traitName.reverse().dropWhile {_ != '.'}.reverse() + methodName
95
102
  let traitMethodScheme = environment.symbols.get(traitMethodName).else {
@@ -143,7 +150,7 @@ extend self: Inference {
143
150
  valueType = definition.type
144
151
  default = None
145
152
  )
146
- let functions = definition.methods.map {method =>
153
+ let functions = catchMany(definition.methods) {method =>
147
154
  let signature = method.signature.Signature(
148
155
  generics = [...definition.generics, ...method.signature.generics]
149
156
  constraints = [...definition.constraints, ...method.signature.constraints]
@@ -1216,3 +1223,30 @@ constraintsToInstances(constraints: List[Constraint]): Map[InstanceKey, Instance
1216
1223
  )
1217
1224
  }.toMap()
1218
1225
  }
1226
+
1227
+ catchMany[T](list: List[T], body: T => T): List[T] {
1228
+ let errors = Array.new()
1229
+ let result = catchManyInto(errors, list, body)
1230
+ errors.drain().{
1231
+ | [] => result
1232
+ | [Pair(_, error)] => error.rethrow()
1233
+ | allErrors => throw(CompileErrors(allErrors.map {_.first}))
1234
+ }
1235
+ }
1236
+
1237
+ catchManyInto[T](errors: Array[Pair[CompileError, Error]], list: List[T], body: T => T): List[T] {
1238
+ let result = list.map {x =>
1239
+ try {
1240
+ body(x)
1241
+ } tryCatch {| CompileError(at, message), error =>
1242
+ errors.push(Pair(CompileError(at, message), error))
1243
+ x
1244
+ } catch {| CompileErrors(compileErrors), error =>
1245
+ compileErrors.each {compileError =>
1246
+ errors.push(Pair(compileError, error))
1247
+ }
1248
+ x
1249
+ }
1250
+ }
1251
+ if(errors.isEmpty()) {result} else {[]}
1252
+ }
@@ -824,7 +824,7 @@ extend self: Parser {
824
824
  while {self.current().rawIs("{")} {
825
825
  guards.push(self.parseCaseGuard())
826
826
  }
827
- if(!self.lspHook.isEnabled() || !self.current().is2(LPipe, LBracketRight)) {
827
+ if(!self.lspHook.isEnabled() || self.current().is(LArrowThick)) {
828
828
  self.skip(LArrowThick)
829
829
  }
830
830
  let body = self.parseStatements()
@@ -1040,7 +1040,13 @@ extend self: Parser {
1040
1040
  }
1041
1041
 
1042
1042
  parseBinary(level: Int): Term {
1043
- if(level >= binaryOperators.size()) {self.parseUnary()} else:
1043
+ if(level >= binaryOperators.size()) {
1044
+ if(self.lspHook.isEnabled() && self.current().is(LBracketRight)) {
1045
+ EVariable(self.current().at(), "")
1046
+ } else {
1047
+ self.parseUnary()
1048
+ }
1049
+ } else:
1044
1050
  let operators = binaryOperators.grab(level)
1045
1051
  mutable result = self.parseBinary(level + 1)
1046
1052
  if(self.current().is(LOperator)) {
@@ -59,17 +59,25 @@ extend self: Resolver {
59
59
  let self2 = self.processImports(module.imports, otherModules)
60
60
  let self3 = self2.processDefinitions(module, None)
61
61
  let module2 = module.Module(
62
- types = module.types.map {self3.resolveTypeDefinition(_)}
63
- traits = module.traits.map {self3.resolveTraitDefinition(_)}
62
+ types = checkDuplicates(module.types.map {self3.resolveTypeDefinition(_)}) {_.name} {_.at}
63
+ traits = checkDuplicates(module.traits.map {self3.resolveTraitDefinition(_)}) {_.name} {_.at}
64
64
  instances = module.instances.map {self3.resolveInstanceDefinition(_)}
65
65
  extends = module.extends.map {self3.resolveExtendDefinition(_)}
66
- lets = module.lets.map {self3.resolveLetDefinition(_, True)}
67
- functions = module.functions.map {self3.resolveFunctionDefinition(_, True, False)}
66
+ lets = checkDuplicates(module.lets.map {self3.resolveLetDefinition(_, True)}) {_.name} {_.at}
67
+ functions = checkDuplicates(
68
+ module.functions.map {self3.resolveFunctionDefinition(_, True, False)}
69
+ ) {_.signature.name} {_.at}
68
70
  )
71
+ let groupedExtendMethods = module2.extends.map {x =>
72
+ Pair(x.type.show([]).takeWhile {_.isAsciiLetterOrDigit()}, x.methods)
73
+ }.group()
74
+ groupedExtendMethods.values().map {_.flatten()}.map {methods =>
75
+ checkDuplicates(methods) {_.signature.name} {_.at}
76
+ }
69
77
  module2.instances.each {_.typeArguments.each {self3.checkInstanceType(_)}}
70
78
  module2
71
79
  }
72
-
80
+
73
81
  checkInstanceType(type: Type) {
74
82
  type.{
75
83
  | TConstructor(_, name, typeArguments) =>
@@ -159,7 +167,7 @@ extend self: Resolver {
159
167
  }
160
168
  definition.DType(
161
169
  constraints = definition.constraints.map {self2.resolveConstraint(_, True)}
162
- commonFields = definition.commonFields.map {f =>
170
+ commonFields = checkDuplicates(definition.commonFields.map {f =>
163
171
  let valueType = self2.resolveType(f.valueType, True)
164
172
  if(self.lspHook.isAt(f.at) || self.lspHook.isDefinedAt(f.at)) {
165
173
  self.lspHook.emit(
@@ -170,13 +178,14 @@ extend self: Resolver {
170
178
  valueType = valueType
171
179
  default = f.default.map {self2.resolveTerm(_, True)}
172
180
  )
173
- }
174
- variants = definition.variants.map {v =>
181
+ }) {_.name} {_.at}
182
+ variants = checkDuplicates(definition.variants.map {v =>
175
183
  if(self.lspHook.isAt(v.at)) {
176
184
  self.lspHook.emit(
177
185
  ResolveSymbolHook(SymbolHook(v.name, v.at, v.at), None, topLevel = True)
178
186
  )
179
187
  }
188
+ checkDuplicates([...definition.commonFields, ...v.fields]) {_.name} {_.at}
180
189
  v.Variant(fields = v.fields.map {f =>
181
190
  let valueType = self2.resolveType(f.valueType, True)
182
191
  if(self.lspHook.isAt(f.at) || self.lspHook.isDefinedAt(f.at)) {
@@ -189,7 +198,7 @@ extend self: Resolver {
189
198
  default = f.default.map {self2.resolveTerm(_, True) }
190
199
  )
191
200
  })
192
- }
201
+ }) {_.name} {_.at}
193
202
  )
194
203
  }
195
204
 
@@ -209,7 +218,9 @@ extend self: Resolver {
209
218
  )
210
219
  definition.DTrait(
211
220
  constraints = definition.constraints.map {self2.resolveConstraint(_, True)}
212
- methods = definition.methods.map {self2.resolveSignature(_, True, False)}
221
+ methods = checkDuplicates(
222
+ definition.methods.map {self2.resolveSignature(_, True, False)}
223
+ ) {_.name} {_.at}
213
224
  methodDefaults = definition.methodDefaults.map {| Pair(name, lambda) =>
214
225
  let signature = definition.methods.find {_.name == name}.grab()
215
226
  let function1 = DFunction(signature.at, signature, lambda)
@@ -623,3 +634,15 @@ extend self: Resolver {
623
634
  }
624
635
 
625
636
  }
637
+
638
+ checkDuplicates[T](items: List[T], name: T => String, at: T => Location): List[T] {
639
+ mutable seen = Map.new()
640
+ items.map {item =>
641
+ let n = name(item)
642
+ if(seen.contains(n)) {
643
+ throw(CompileError(at(item), "Duplicate definition: " + n))
644
+ }
645
+ seen = seen.add(n, item)
646
+ }
647
+ items
648
+ }
package/lsp/Handler.ff CHANGED
@@ -279,6 +279,9 @@ extend self: Handler {
279
279
  } tryCatch {| CompileError(at, message), error =>
280
280
  Log.trace("handleDocumentSymbol parse error: " + message)
281
281
  []
282
+ } tryCatch {| CompileErrors(_), error =>
283
+ Log.trace("handleDocumentSymbol parse errors: ")
284
+ []
282
285
  } catch {| ReadSymbolsError e, _ =>
283
286
  Log.trace("handleDocumentSymbol ReadSymbolsError")
284
287
  []
@@ -402,8 +405,10 @@ extend self: Handler {
402
405
  let tokens = Tokenizer.tokenize(cursorAt.file, code, None, True)
403
406
  let parser = Parser.new(PackagePair("script", "script"), cursorAt.file, tokens, False, lspHook)
404
407
  parser.parseModuleWithPackageInfo()
405
- } catch {| CompileError(at, message), error =>
408
+ } tryCatch {| CompileError(at, message), error =>
406
409
  Log.trace("handleSignatureHelp check error: " + message)
410
+ } catch {| CompileErrors(_), error =>
411
+ Log.trace("handleSignatureHelp check errors")
407
412
  }
408
413
  let o = lspHook.results().collectFirst {
409
414
  | ParseArgumentHook h {parameters.get("context") | Some(context)} {
@@ -209,19 +209,23 @@ return (_w1 + "/")
209
209
  if((!ff_core_Map.Map_contains(self_.packagePaths_, newPackagePair_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair))) {
210
210
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(import_.at_, ("Missing dependency declaration for: " + ff_compiler_Syntax.PackagePair_groupName(newPackagePair_, ":"))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
211
211
  };
212
- try {
212
+ return ff_core_Try.Try_catch(ff_core_Try.Try_tryCatch(ff_core_Core.try_((() => {
213
213
  return ff_compiler_Compiler.Compiler_parse(self_, newPackagePair_, newModuleName_, ff_core_Option.Some(import_.at_))
214
- } catch(_error) {
215
- if(!_error.ffException) throw _error
216
- const _exception = ff_core_Any.fromAny_(_error.ffException, ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)
217
- if(!_exception.Some) throw _error
214
+ })), ((_1, _2) => {
218
215
  {
219
- const e_ = _exception.value_;
220
- const error_ = _error;
216
+ const e_ = _1;
217
+ const error_ = _2;
221
218
  const newError_ = ff_compiler_Syntax.CompileError(import_.at_, ((("Parse error in imported module: " + ff_compiler_Syntax.PackagePair_groupName(import_.package_, ":")) + "/") + newModuleName_));
222
219
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileErrors([e_, newError_]), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileErrors)})
223
220
  }
221
+ }), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError), ((_1, _2) => {
222
+ {
223
+ const compileErrors_ = _1.errors_;
224
+ const error_ = _2;
225
+ const newError_ = ff_compiler_Syntax.CompileError(import_.at_, ((("Parse errors in imported module: " + ff_compiler_Syntax.PackagePair_groupName(import_.package_, ":")) + "/") + newModuleName_));
226
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileErrors([...compileErrors_, newError_]), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileErrors)})
224
227
  }
228
+ }), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileErrors)
225
229
  }))
226
230
  }
227
231
 
@@ -346,19 +350,23 @@ return (_w1 + "/")
346
350
  if((!ff_core_Map.Map_contains(self_.packagePaths_, newPackagePair_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair))) {
347
351
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(import_.at_, ("Missing dependency declaration for: " + ff_compiler_Syntax.PackagePair_groupName(newPackagePair_, ":"))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
348
352
  };
349
- try {
353
+ return ff_core_Try.Try_catch(ff_core_Try.Try_tryCatch((await ff_core_Core.try_$((async ($task) => {
350
354
  return (await ff_compiler_Compiler.Compiler_parse$(self_, newPackagePair_, newModuleName_, ff_core_Option.Some(import_.at_), $task))
351
- } catch(_error) {
352
- if(!_error.ffException) throw _error
353
- const _exception = ff_core_Any.fromAny_(_error.ffException, ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)
354
- if(!_exception.Some) throw _error
355
+ }), $task)), ((_1, _2) => {
355
356
  {
356
- const e_ = _exception.value_;
357
- const error_ = _error;
357
+ const e_ = _1;
358
+ const error_ = _2;
358
359
  const newError_ = ff_compiler_Syntax.CompileError(import_.at_, ((("Parse error in imported module: " + ff_compiler_Syntax.PackagePair_groupName(import_.package_, ":")) + "/") + newModuleName_));
359
360
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileErrors([e_, newError_]), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileErrors)})
360
361
  }
362
+ }), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError), ((_1, _2) => {
363
+ {
364
+ const compileErrors_ = _1.errors_;
365
+ const error_ = _2;
366
+ const newError_ = ff_compiler_Syntax.CompileError(import_.at_, ((("Parse errors in imported module: " + ff_compiler_Syntax.PackagePair_groupName(import_.package_, ":")) + "/") + newModuleName_));
367
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileErrors([...compileErrors_, newError_]), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileErrors)})
361
368
  }
369
+ }), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileErrors)
362
370
  }), $task))
363
371
  }
364
372
 
@@ -142,6 +142,59 @@ return ff_core_Pair.Pair(ff_compiler_Unification.InstanceKey(c_.name_, typeName_
142
142
  })), ff_compiler_Unification.ff_core_Ordering_Order$ff_compiler_Unification_InstanceKey)
143
143
  }
144
144
 
145
+ export function catchMany_(list_, body_) {
146
+ const errors_ = ff_core_Array.new_();
147
+ const result_ = ff_compiler_Inference.catchManyInto_(errors_, list_, body_);
148
+ {
149
+ const _1 = ff_core_Array.Array_drain(errors_);
150
+ if(_1.length === 0) {
151
+ return result_
152
+ }
153
+ if(_1.length === 1) {
154
+ const error_ = _1[0].second_;
155
+ return ff_core_Error.Error_rethrow(error_)
156
+ }
157
+ {
158
+ const allErrors_ = _1;
159
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileErrors(ff_core_List.List_map(allErrors_, ((_w1) => {
160
+ return _w1.first_
161
+ }))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileErrors)})
162
+ return
163
+ }
164
+ }
165
+ }
166
+
167
+ export function catchManyInto_(errors_, list_, body_) {
168
+ const result_ = ff_core_List.List_map(list_, ((x_) => {
169
+ return ff_core_Try.Try_catch(ff_core_Try.Try_tryCatch(ff_core_Core.try_((() => {
170
+ return body_(x_)
171
+ })), ((_1, _2) => {
172
+ {
173
+ const at_ = _1.at_;
174
+ const message_ = _1.message_;
175
+ const error_ = _2;
176
+ errors_.array.push(ff_core_Pair.Pair(ff_compiler_Syntax.CompileError(at_, message_), error_));
177
+ return x_
178
+ }
179
+ }), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError), ((_1, _2) => {
180
+ {
181
+ const compileErrors_ = _1.errors_;
182
+ const error_ = _2;
183
+ for(let for_a = compileErrors_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
184
+ const compileError_ = for_a[for_i];
185
+ errors_.array.push(ff_core_Pair.Pair(compileError_, error_))
186
+ };
187
+ return x_
188
+ }
189
+ }), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileErrors)
190
+ }));
191
+ if(ff_core_Array.Array_isEmpty(errors_)) {
192
+ return result_
193
+ } else {
194
+ return []
195
+ }
196
+ }
197
+
145
198
  export async function new_$(modules_, lspHook_, $task) {
146
199
  return ff_compiler_Inference.Inference(ff_compiler_Unification.new_(modules_, ff_compiler_LspHook.LspHook_isEnabled(lspHook_)), ff_core_StringMap.new_(), lspHook_)
147
200
  }
@@ -171,23 +224,95 @@ return ff_core_Pair.Pair(ff_compiler_Unification.InstanceKey(c_.name_, typeName_
171
224
  })), ff_compiler_Unification.ff_core_Ordering_Order$ff_compiler_Unification_InstanceKey)
172
225
  }
173
226
 
227
+ export async function catchMany_$(list_, body_, $task) {
228
+ const errors_ = ff_core_Array.new_();
229
+ const result_ = (await ff_compiler_Inference.catchManyInto_$(errors_, list_, body_, $task));
230
+ {
231
+ const _1 = ff_core_Array.Array_drain(errors_);
232
+ if(_1.length === 0) {
233
+ return result_
234
+ }
235
+ if(_1.length === 1) {
236
+ const error_ = _1[0].second_;
237
+ return ff_core_Error.Error_rethrow(error_)
238
+ }
239
+ {
240
+ const allErrors_ = _1;
241
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileErrors(ff_core_List.List_map(allErrors_, ((_w1) => {
242
+ return _w1.first_
243
+ }))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileErrors)})
244
+ return
245
+ }
246
+ }
247
+ }
248
+
249
+ export async function catchManyInto_$(errors_, list_, body_, $task) {
250
+ const result_ = (await ff_core_List.List_map$(list_, (async (x_, $task) => {
251
+ return ff_core_Try.Try_catch(ff_core_Try.Try_tryCatch((await ff_core_Core.try_$((async ($task) => {
252
+ return (await body_(x_, $task))
253
+ }), $task)), ((_1, _2) => {
254
+ {
255
+ const at_ = _1.at_;
256
+ const message_ = _1.message_;
257
+ const error_ = _2;
258
+ errors_.array.push(ff_core_Pair.Pair(ff_compiler_Syntax.CompileError(at_, message_), error_));
259
+ return x_
260
+ }
261
+ }), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError), ((_1, _2) => {
262
+ {
263
+ const compileErrors_ = _1.errors_;
264
+ const error_ = _2;
265
+ for(let for_a = compileErrors_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
266
+ const compileError_ = for_a[for_i];
267
+ errors_.array.push(ff_core_Pair.Pair(compileError_, error_))
268
+ };
269
+ return x_
270
+ }
271
+ }), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileErrors)
272
+ }), $task));
273
+ if(ff_core_Array.Array_isEmpty(errors_)) {
274
+ return result_
275
+ } else {
276
+ return []
277
+ }
278
+ }
279
+
174
280
  export function Inference_inferModule(self_, module_, otherModules_) {
175
281
  const environment_ = ff_compiler_Environment.new_(module_, otherModules_, false);
176
- const traits_ = ff_core_List.List_map(module_.traits_, ((_w1) => {
282
+ const errors_ = ff_core_Array.new_();
283
+ const traits_ = ff_compiler_Inference.catchManyInto_(errors_, module_.traits_, ((_w1) => {
177
284
  return ff_compiler_Inference.Inference_inferTraitDefinition(self_, environment_, _w1)
178
285
  }));
179
- const instances_ = ff_core_List.List_map(module_.instances_, ((_w1) => {
286
+ const instances_ = ff_compiler_Inference.catchManyInto_(errors_, module_.instances_, ((_w1) => {
180
287
  return ff_compiler_Inference.Inference_inferInstanceDefinition(self_, environment_, _w1)
181
288
  }));
182
- const lets_ = ff_core_List.List_map(module_.lets_, ((_w1) => {
289
+ const lets_ = ff_compiler_Inference.catchManyInto_(errors_, module_.lets_, ((_w1) => {
183
290
  return ff_compiler_Inference.Inference_inferLetDefinition(self_, environment_, _w1)
184
291
  }));
185
- const functions_ = ff_core_List.List_map(module_.functions_, ((_w1) => {
292
+ const functions_ = ff_compiler_Inference.catchManyInto_(errors_, module_.functions_, ((_w1) => {
186
293
  return ff_compiler_Inference.Inference_inferFunctionDefinition(self_, environment_, _w1)
187
294
  }));
188
- const extends_ = ff_core_List.List_map(module_.extends_, ((_w1) => {
295
+ const extends_ = ff_compiler_Inference.catchManyInto_(errors_, module_.extends_, ((_w1) => {
189
296
  return ff_compiler_Inference.Inference_inferExtendDefinition(self_, environment_, _w1)
190
297
  }));
298
+ do {
299
+ const _1 = ff_core_Array.Array_drain(errors_);
300
+ if(_1.length === 0) {
301
+
302
+ break
303
+ }
304
+ if(_1.length === 1) {
305
+ const error_ = _1[0].second_;
306
+ ff_core_Error.Error_rethrow(error_)
307
+ break
308
+ }
309
+ {
310
+ const allErrors_ = _1;
311
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileErrors(ff_core_List.List_map(allErrors_, ((_w1) => {
312
+ return _w1.first_
313
+ }))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileErrors)})
314
+ }
315
+ } while(false);
191
316
  const result_ = (((_c) => {
192
317
  return ff_compiler_Syntax.Module(_c.file_, _c.packagePair_, _c.imports_, _c.types_, traits_, instances_, extends_, lets_, functions_)
193
318
  }))(module_);
@@ -236,7 +361,7 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Sy
236
361
  const _1 = definition_;
237
362
  {
238
363
  const _c = _1;
239
- return ff_compiler_Syntax.DInstance(_c.at_, _c.generics_, _c.constraints_, _c.traitName_, _c.typeArguments_, _c.generatorArguments_, ff_core_List.List_map(definition_.methods_, ((instanceFunction_) => {
364
+ return ff_compiler_Syntax.DInstance(_c.at_, _c.generics_, _c.constraints_, _c.traitName_, _c.typeArguments_, _c.generatorArguments_, ff_compiler_Inference.catchMany_(definition_.methods_, ((instanceFunction_) => {
240
365
  const methodName_ = instanceFunction_.signature_.name_;
241
366
  const traitMethodName_ = (ff_core_String.String_reverse(ff_core_String.String_dropWhile(ff_core_String.String_reverse(traitName_), ((_w1) => {
242
367
  return (_w1 !== 46)
@@ -295,7 +420,7 @@ return ff_compiler_Syntax.DLet(_c.at_, _c.name_, _c.variableType_, value_)
295
420
 
296
421
  export function Inference_inferExtendDefinition(self_, environment_, definition_) {
297
422
  const selfParameter_ = ff_compiler_Syntax.Parameter(definition_.at_, false, definition_.name_, definition_.type_, ff_core_Option.None());
298
- const functions_ = ff_core_List.List_map(definition_.methods_, ((method_) => {
423
+ const functions_ = ff_compiler_Inference.catchMany_(definition_.methods_, ((method_) => {
299
424
  const signature_ = (((_c) => {
300
425
  return ff_compiler_Syntax.Signature(_c.at_, _c.name_, _c.member_, [...definition_.generics_, ...method_.signature_.generics_], [...definition_.constraints_, ...method_.signature_.constraints_], [selfParameter_, ...method_.signature_.parameters_], _c.returnType_, _c.effect_)
301
426
  }))(method_.signature_);
@@ -2071,21 +2196,40 @@ return instantiated_
2071
2196
 
2072
2197
  export async function Inference_inferModule$(self_, module_, otherModules_, $task) {
2073
2198
  const environment_ = ff_compiler_Environment.new_(module_, otherModules_, false);
2074
- const traits_ = ff_core_List.List_map(module_.traits_, ((_w1) => {
2199
+ const errors_ = ff_core_Array.new_();
2200
+ const traits_ = ff_compiler_Inference.catchManyInto_(errors_, module_.traits_, ((_w1) => {
2075
2201
  return ff_compiler_Inference.Inference_inferTraitDefinition(self_, environment_, _w1)
2076
2202
  }));
2077
- const instances_ = ff_core_List.List_map(module_.instances_, ((_w1) => {
2203
+ const instances_ = ff_compiler_Inference.catchManyInto_(errors_, module_.instances_, ((_w1) => {
2078
2204
  return ff_compiler_Inference.Inference_inferInstanceDefinition(self_, environment_, _w1)
2079
2205
  }));
2080
- const lets_ = ff_core_List.List_map(module_.lets_, ((_w1) => {
2206
+ const lets_ = ff_compiler_Inference.catchManyInto_(errors_, module_.lets_, ((_w1) => {
2081
2207
  return ff_compiler_Inference.Inference_inferLetDefinition(self_, environment_, _w1)
2082
2208
  }));
2083
- const functions_ = ff_core_List.List_map(module_.functions_, ((_w1) => {
2209
+ const functions_ = ff_compiler_Inference.catchManyInto_(errors_, module_.functions_, ((_w1) => {
2084
2210
  return ff_compiler_Inference.Inference_inferFunctionDefinition(self_, environment_, _w1)
2085
2211
  }));
2086
- const extends_ = ff_core_List.List_map(module_.extends_, ((_w1) => {
2212
+ const extends_ = ff_compiler_Inference.catchManyInto_(errors_, module_.extends_, ((_w1) => {
2087
2213
  return ff_compiler_Inference.Inference_inferExtendDefinition(self_, environment_, _w1)
2088
2214
  }));
2215
+ do {
2216
+ const _1 = ff_core_Array.Array_drain(errors_);
2217
+ if(_1.length === 0) {
2218
+
2219
+ break
2220
+ }
2221
+ if(_1.length === 1) {
2222
+ const error_ = _1[0].second_;
2223
+ ff_core_Error.Error_rethrow(error_)
2224
+ break
2225
+ }
2226
+ {
2227
+ const allErrors_ = _1;
2228
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileErrors(ff_core_List.List_map(allErrors_, ((_w1) => {
2229
+ return _w1.first_
2230
+ }))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileErrors)})
2231
+ }
2232
+ } while(false);
2089
2233
  const result_ = (((_c) => {
2090
2234
  return ff_compiler_Syntax.Module(_c.file_, _c.packagePair_, _c.imports_, _c.types_, traits_, instances_, extends_, lets_, functions_)
2091
2235
  }))(module_);
@@ -2134,7 +2278,7 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Sy
2134
2278
  const _1 = definition_;
2135
2279
  {
2136
2280
  const _c = _1;
2137
- return ff_compiler_Syntax.DInstance(_c.at_, _c.generics_, _c.constraints_, _c.traitName_, _c.typeArguments_, _c.generatorArguments_, ff_core_List.List_map(definition_.methods_, ((instanceFunction_) => {
2281
+ return ff_compiler_Syntax.DInstance(_c.at_, _c.generics_, _c.constraints_, _c.traitName_, _c.typeArguments_, _c.generatorArguments_, ff_compiler_Inference.catchMany_(definition_.methods_, ((instanceFunction_) => {
2138
2282
  const methodName_ = instanceFunction_.signature_.name_;
2139
2283
  const traitMethodName_ = (ff_core_String.String_reverse(ff_core_String.String_dropWhile(ff_core_String.String_reverse(traitName_), ((_w1) => {
2140
2284
  return (_w1 !== 46)
@@ -2193,7 +2337,7 @@ return ff_compiler_Syntax.DLet(_c.at_, _c.name_, _c.variableType_, value_)
2193
2337
 
2194
2338
  export async function Inference_inferExtendDefinition$(self_, environment_, definition_, $task) {
2195
2339
  const selfParameter_ = ff_compiler_Syntax.Parameter(definition_.at_, false, definition_.name_, definition_.type_, ff_core_Option.None());
2196
- const functions_ = ff_core_List.List_map(definition_.methods_, ((method_) => {
2340
+ const functions_ = ff_compiler_Inference.catchMany_(definition_.methods_, ((method_) => {
2197
2341
  const signature_ = (((_c) => {
2198
2342
  return ff_compiler_Syntax.Signature(_c.at_, _c.name_, _c.member_, [...definition_.generics_, ...method_.signature_.generics_], [...definition_.constraints_, ...method_.signature_.constraints_], [selfParameter_, ...method_.signature_.parameters_], _c.returnType_, _c.effect_)
2199
2343
  }))(method_.signature_);
@@ -933,7 +933,7 @@ const guards_ = ff_core_Array.new_();
933
933
  while(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")) {
934
934
  guards_.array.push(ff_compiler_Parser.Parser_parseCaseGuard(self_))
935
935
  };
936
- if(((!ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) || (!ff_compiler_Token.Token_is2(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LPipe(), ff_compiler_Token.LBracketRight())))) {
936
+ if(((!ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) || ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LArrowThick()))) {
937
937
  ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LArrowThick())
938
938
  };
939
939
  const body_ = ff_compiler_Parser.Parser_parseStatements(self_);
@@ -1201,7 +1201,11 @@ return ff_compiler_Parser.Parser_parseBinary(self_, 0)
1201
1201
 
1202
1202
  export function Parser_parseBinary(self_, level_) {
1203
1203
  if((level_ >= ff_compiler_Parser.binaryOperators_.length)) {
1204
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
1205
+ return ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), "")
1206
+ } else {
1204
1207
  return ff_compiler_Parser.Parser_parseUnary(self_)
1208
+ }
1205
1209
  } else {
1206
1210
  const operators_ = (ff_compiler_Parser.binaryOperators_[level_] ?? ff_core_List.List_grab(ff_compiler_Parser.binaryOperators_, level_));
1207
1211
  let result_ = ff_compiler_Parser.Parser_parseBinary(self_, (level_ + 1));
@@ -2433,7 +2437,7 @@ const guards_ = ff_core_Array.new_();
2433
2437
  while(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")) {
2434
2438
  guards_.array.push(ff_compiler_Parser.Parser_parseCaseGuard(self_))
2435
2439
  };
2436
- if(((!ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) || (!ff_compiler_Token.Token_is2(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LPipe(), ff_compiler_Token.LBracketRight())))) {
2440
+ if(((!ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) || ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LArrowThick()))) {
2437
2441
  ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LArrowThick())
2438
2442
  };
2439
2443
  const body_ = ff_compiler_Parser.Parser_parseStatements(self_);
@@ -2701,7 +2705,11 @@ return ff_compiler_Parser.Parser_parseBinary(self_, 0)
2701
2705
 
2702
2706
  export async function Parser_parseBinary$(self_, level_, $task) {
2703
2707
  if((level_ >= ff_compiler_Parser.binaryOperators_.length)) {
2708
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
2709
+ return ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), "")
2710
+ } else {
2704
2711
  return ff_compiler_Parser.Parser_parseUnary(self_)
2712
+ }
2705
2713
  } else {
2706
2714
  const operators_ = (ff_compiler_Parser.binaryOperators_[level_] ?? ff_core_List.List_grab(ff_compiler_Parser.binaryOperators_, level_));
2707
2715
  let result_ = ff_compiler_Parser.Parser_parseBinary(self_, (level_ + 1));
@@ -121,10 +121,34 @@ export function new_(packagePair_, moduleName_, lspHook_) {
121
121
  return ff_compiler_Resolver.Resolver(ff_core_List.List_toMap([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_toMap([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_toMap([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_toMap([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_toMap([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_toMap([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_toSet([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_toSet([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_toMap([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_toMap([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_compiler_Resolver.ResolverState(2), lspHook_)
122
122
  }
123
123
 
124
+ export function checkDuplicates_(items_, name_, at_) {
125
+ let seen_ = ff_core_Map.new_();
126
+ ff_core_List.List_map(items_, ((item_) => {
127
+ const n_ = name_(item_);
128
+ if(ff_core_Map.Map_contains(seen_, n_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)) {
129
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_(item_), ("Duplicate definition: " + n_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
130
+ };
131
+ seen_ = ff_core_Map.Map_add(seen_, n_, item_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
132
+ }));
133
+ return items_
134
+ }
135
+
124
136
  export async function new_$(packagePair_, moduleName_, lspHook_, $task) {
125
137
  return ff_compiler_Resolver.Resolver(ff_core_List.List_toMap([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_toMap([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_toMap([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_toMap([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_toMap([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_toMap([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_toSet([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_toSet([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_toMap([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_toMap([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_compiler_Resolver.ResolverState(2), lspHook_)
126
138
  }
127
139
 
140
+ export async function checkDuplicates_$(items_, name_, at_, $task) {
141
+ let seen_ = ff_core_Map.new_();
142
+ (await ff_core_List.List_map$(items_, (async (item_, $task) => {
143
+ const n_ = (await name_(item_, $task));
144
+ if(ff_core_Map.Map_contains(seen_, n_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)) {
145
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError((await at_(item_, $task)), ("Duplicate definition: " + n_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
146
+ };
147
+ seen_ = ff_core_Map.Map_add(seen_, n_, item_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
148
+ }), $task));
149
+ return items_
150
+ }
151
+
128
152
  export function Resolver_freshUnificationVariable(self_, at_) {
129
153
  const result_ = ff_compiler_Syntax.TVariable(at_, self_.state_.nextUnificationVariableIndex_);
130
154
  self_.state_.nextUnificationVariableIndex_ += 3;
@@ -140,20 +164,50 @@ return (_w1 !== 46)
140
164
  const self2_ = ff_compiler_Resolver.Resolver_processImports(self_, module_.imports_, otherModules_);
141
165
  const self3_ = ff_compiler_Resolver.Resolver_processDefinitions(self2_, module_, ff_core_Option.None());
142
166
  const module2_ = (((_c) => {
143
- return ff_compiler_Syntax.Module(_c.file_, _c.packagePair_, _c.imports_, ff_core_List.List_map(module_.types_, ((_w1) => {
167
+ return ff_compiler_Syntax.Module(_c.file_, _c.packagePair_, _c.imports_, ff_compiler_Resolver.checkDuplicates_(ff_core_List.List_map(module_.types_, ((_w1) => {
144
168
  return ff_compiler_Resolver.Resolver_resolveTypeDefinition(self3_, _w1)
145
- })), ff_core_List.List_map(module_.traits_, ((_w1) => {
169
+ })), ((_w1) => {
170
+ return _w1.name_
171
+ }), ((_w1) => {
172
+ return _w1.at_
173
+ })), ff_compiler_Resolver.checkDuplicates_(ff_core_List.List_map(module_.traits_, ((_w1) => {
146
174
  return ff_compiler_Resolver.Resolver_resolveTraitDefinition(self3_, _w1)
175
+ })), ((_w1) => {
176
+ return _w1.name_
177
+ }), ((_w1) => {
178
+ return _w1.at_
147
179
  })), ff_core_List.List_map(module_.instances_, ((_w1) => {
148
180
  return ff_compiler_Resolver.Resolver_resolveInstanceDefinition(self3_, _w1)
149
181
  })), ff_core_List.List_map(module_.extends_, ((_w1) => {
150
182
  return ff_compiler_Resolver.Resolver_resolveExtendDefinition(self3_, _w1)
151
- })), ff_core_List.List_map(module_.lets_, ((_w1) => {
183
+ })), ff_compiler_Resolver.checkDuplicates_(ff_core_List.List_map(module_.lets_, ((_w1) => {
152
184
  return ff_compiler_Resolver.Resolver_resolveLetDefinition(self3_, _w1, true)
153
- })), ff_core_List.List_map(module_.functions_, ((_w1) => {
185
+ })), ((_w1) => {
186
+ return _w1.name_
187
+ }), ((_w1) => {
188
+ return _w1.at_
189
+ })), ff_compiler_Resolver.checkDuplicates_(ff_core_List.List_map(module_.functions_, ((_w1) => {
154
190
  return ff_compiler_Resolver.Resolver_resolveFunctionDefinition(self3_, _w1, true, false)
191
+ })), ((_w1) => {
192
+ return _w1.signature_.name_
193
+ }), ((_w1) => {
194
+ return _w1.at_
155
195
  })))
156
196
  }))(module_);
197
+ const groupedExtendMethods_ = ff_core_List.List_group(ff_core_List.List_map(module2_.extends_, ((x_) => {
198
+ return ff_core_Pair.Pair(ff_core_String.String_takeWhile(ff_compiler_Syntax.Type_show(x_.type_, []), ((_w1) => {
199
+ return ff_core_Char.Char_isAsciiLetterOrDigit(_w1)
200
+ })), x_.methods_)
201
+ })), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
202
+ ff_core_List.List_map(ff_core_List.List_map(ff_core_Map.Map_values(groupedExtendMethods_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_w1) => {
203
+ return ff_core_List.List_flatten(_w1)
204
+ })), ((methods_) => {
205
+ return ff_compiler_Resolver.checkDuplicates_(methods_, ((_w1) => {
206
+ return _w1.signature_.name_
207
+ }), ((_w1) => {
208
+ return _w1.at_
209
+ }))
210
+ }));
157
211
  for(let for_a = module2_.instances_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
158
212
  const _w1 = for_a[for_i];
159
213
  for(let for_a = _w1.typeArguments_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
@@ -338,7 +392,7 @@ const _1 = definition_;
338
392
  const _c = _1;
339
393
  return ff_compiler_Syntax.DType(_c.at_, _c.newtype_, _c.data_, _c.name_, _c.generics_, ff_core_List.List_map(definition_.constraints_, ((_w1) => {
340
394
  return ff_compiler_Resolver.Resolver_resolveConstraint(self2_, _w1, true)
341
- })), ff_core_List.List_map(definition_.commonFields_, ((f_) => {
395
+ })), ff_compiler_Resolver.checkDuplicates_(ff_core_List.List_map(definition_.commonFields_, ((f_) => {
342
396
  const valueType_ = ff_compiler_Resolver.Resolver_resolveType(self2_, f_.valueType_, true);
343
397
  if((ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, f_.at_) || ff_compiler_LspHook.LspHook_isDefinedAt(self_.lspHook_, f_.at_))) {
344
398
  ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ResolveVariantFieldHook(ff_compiler_LspHook.SymbolHook(f_.name_, f_.at_, f_.at_), valueType_, true))
@@ -353,10 +407,19 @@ return ff_compiler_Resolver.Resolver_resolveTerm(self2_, _w1, true, false)
353
407
  return
354
408
  }
355
409
  }
356
- })), ff_core_List.List_map(definition_.variants_, ((v_) => {
410
+ })), ((_w1) => {
411
+ return _w1.name_
412
+ }), ((_w1) => {
413
+ return _w1.at_
414
+ })), ff_compiler_Resolver.checkDuplicates_(ff_core_List.List_map(definition_.variants_, ((v_) => {
357
415
  if(ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, v_.at_)) {
358
416
  ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ResolveSymbolHook(ff_compiler_LspHook.SymbolHook(v_.name_, v_.at_, v_.at_), ff_core_Option.None(), true))
359
417
  };
418
+ ff_compiler_Resolver.checkDuplicates_([...definition_.commonFields_, ...v_.fields_], ((_w1) => {
419
+ return _w1.name_
420
+ }), ((_w1) => {
421
+ return _w1.at_
422
+ }));
360
423
  {
361
424
  const _1 = v_;
362
425
  {
@@ -380,6 +443,10 @@ return
380
443
  return
381
444
  }
382
445
  }
446
+ })), ((_w1) => {
447
+ return _w1.name_
448
+ }), ((_w1) => {
449
+ return _w1.at_
383
450
  })))
384
451
  return
385
452
  }
@@ -402,8 +469,12 @@ const _1 = definition_;
402
469
  const _c = _1;
403
470
  return ff_compiler_Syntax.DTrait(_c.at_, _c.name_, _c.generics_, ff_core_List.List_map(definition_.constraints_, ((_w1) => {
404
471
  return ff_compiler_Resolver.Resolver_resolveConstraint(self2_, _w1, true)
405
- })), _c.generatorParameters_, ff_core_List.List_map(definition_.methods_, ((_w1) => {
472
+ })), _c.generatorParameters_, ff_compiler_Resolver.checkDuplicates_(ff_core_List.List_map(definition_.methods_, ((_w1) => {
406
473
  return ff_compiler_Resolver.Resolver_resolveSignature(self2_, _w1, true, false)
474
+ })), ((_w1) => {
475
+ return _w1.name_
476
+ }), ((_w1) => {
477
+ return _w1.at_
407
478
  })), ff_core_List.List_map(definition_.methodDefaults_, ((_1) => {
408
479
  {
409
480
  const name_ = _1.first_;
@@ -1071,20 +1142,50 @@ return (_w1 !== 46)
1071
1142
  const self2_ = ff_compiler_Resolver.Resolver_processImports(self_, module_.imports_, otherModules_);
1072
1143
  const self3_ = ff_compiler_Resolver.Resolver_processDefinitions(self2_, module_, ff_core_Option.None());
1073
1144
  const module2_ = (((_c) => {
1074
- return ff_compiler_Syntax.Module(_c.file_, _c.packagePair_, _c.imports_, ff_core_List.List_map(module_.types_, ((_w1) => {
1145
+ return ff_compiler_Syntax.Module(_c.file_, _c.packagePair_, _c.imports_, ff_compiler_Resolver.checkDuplicates_(ff_core_List.List_map(module_.types_, ((_w1) => {
1075
1146
  return ff_compiler_Resolver.Resolver_resolveTypeDefinition(self3_, _w1)
1076
- })), ff_core_List.List_map(module_.traits_, ((_w1) => {
1147
+ })), ((_w1) => {
1148
+ return _w1.name_
1149
+ }), ((_w1) => {
1150
+ return _w1.at_
1151
+ })), ff_compiler_Resolver.checkDuplicates_(ff_core_List.List_map(module_.traits_, ((_w1) => {
1077
1152
  return ff_compiler_Resolver.Resolver_resolveTraitDefinition(self3_, _w1)
1153
+ })), ((_w1) => {
1154
+ return _w1.name_
1155
+ }), ((_w1) => {
1156
+ return _w1.at_
1078
1157
  })), ff_core_List.List_map(module_.instances_, ((_w1) => {
1079
1158
  return ff_compiler_Resolver.Resolver_resolveInstanceDefinition(self3_, _w1)
1080
1159
  })), ff_core_List.List_map(module_.extends_, ((_w1) => {
1081
1160
  return ff_compiler_Resolver.Resolver_resolveExtendDefinition(self3_, _w1)
1082
- })), ff_core_List.List_map(module_.lets_, ((_w1) => {
1161
+ })), ff_compiler_Resolver.checkDuplicates_(ff_core_List.List_map(module_.lets_, ((_w1) => {
1083
1162
  return ff_compiler_Resolver.Resolver_resolveLetDefinition(self3_, _w1, true)
1084
- })), ff_core_List.List_map(module_.functions_, ((_w1) => {
1163
+ })), ((_w1) => {
1164
+ return _w1.name_
1165
+ }), ((_w1) => {
1166
+ return _w1.at_
1167
+ })), ff_compiler_Resolver.checkDuplicates_(ff_core_List.List_map(module_.functions_, ((_w1) => {
1085
1168
  return ff_compiler_Resolver.Resolver_resolveFunctionDefinition(self3_, _w1, true, false)
1169
+ })), ((_w1) => {
1170
+ return _w1.signature_.name_
1171
+ }), ((_w1) => {
1172
+ return _w1.at_
1086
1173
  })))
1087
1174
  }))(module_);
1175
+ const groupedExtendMethods_ = ff_core_List.List_group(ff_core_List.List_map(module2_.extends_, ((x_) => {
1176
+ return ff_core_Pair.Pair(ff_core_String.String_takeWhile(ff_compiler_Syntax.Type_show(x_.type_, []), ((_w1) => {
1177
+ return ff_core_Char.Char_isAsciiLetterOrDigit(_w1)
1178
+ })), x_.methods_)
1179
+ })), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
1180
+ ff_core_List.List_map(ff_core_List.List_map(ff_core_Map.Map_values(groupedExtendMethods_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_w1) => {
1181
+ return ff_core_List.List_flatten(_w1)
1182
+ })), ((methods_) => {
1183
+ return ff_compiler_Resolver.checkDuplicates_(methods_, ((_w1) => {
1184
+ return _w1.signature_.name_
1185
+ }), ((_w1) => {
1186
+ return _w1.at_
1187
+ }))
1188
+ }));
1088
1189
  for(let for_a = module2_.instances_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
1089
1190
  const _w1 = for_a[for_i];
1090
1191
  for(let for_a = _w1.typeArguments_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
@@ -1269,7 +1370,7 @@ const _1 = definition_;
1269
1370
  const _c = _1;
1270
1371
  return ff_compiler_Syntax.DType(_c.at_, _c.newtype_, _c.data_, _c.name_, _c.generics_, ff_core_List.List_map(definition_.constraints_, ((_w1) => {
1271
1372
  return ff_compiler_Resolver.Resolver_resolveConstraint(self2_, _w1, true)
1272
- })), ff_core_List.List_map(definition_.commonFields_, ((f_) => {
1373
+ })), ff_compiler_Resolver.checkDuplicates_(ff_core_List.List_map(definition_.commonFields_, ((f_) => {
1273
1374
  const valueType_ = ff_compiler_Resolver.Resolver_resolveType(self2_, f_.valueType_, true);
1274
1375
  if((ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, f_.at_) || ff_compiler_LspHook.LspHook_isDefinedAt(self_.lspHook_, f_.at_))) {
1275
1376
  ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ResolveVariantFieldHook(ff_compiler_LspHook.SymbolHook(f_.name_, f_.at_, f_.at_), valueType_, true))
@@ -1284,10 +1385,19 @@ return ff_compiler_Resolver.Resolver_resolveTerm(self2_, _w1, true, false)
1284
1385
  return
1285
1386
  }
1286
1387
  }
1287
- })), ff_core_List.List_map(definition_.variants_, ((v_) => {
1388
+ })), ((_w1) => {
1389
+ return _w1.name_
1390
+ }), ((_w1) => {
1391
+ return _w1.at_
1392
+ })), ff_compiler_Resolver.checkDuplicates_(ff_core_List.List_map(definition_.variants_, ((v_) => {
1288
1393
  if(ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, v_.at_)) {
1289
1394
  ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ResolveSymbolHook(ff_compiler_LspHook.SymbolHook(v_.name_, v_.at_, v_.at_), ff_core_Option.None(), true))
1290
1395
  };
1396
+ ff_compiler_Resolver.checkDuplicates_([...definition_.commonFields_, ...v_.fields_], ((_w1) => {
1397
+ return _w1.name_
1398
+ }), ((_w1) => {
1399
+ return _w1.at_
1400
+ }));
1291
1401
  {
1292
1402
  const _1 = v_;
1293
1403
  {
@@ -1311,6 +1421,10 @@ return
1311
1421
  return
1312
1422
  }
1313
1423
  }
1424
+ })), ((_w1) => {
1425
+ return _w1.name_
1426
+ }), ((_w1) => {
1427
+ return _w1.at_
1314
1428
  })))
1315
1429
  return
1316
1430
  }
@@ -1333,8 +1447,12 @@ const _1 = definition_;
1333
1447
  const _c = _1;
1334
1448
  return ff_compiler_Syntax.DTrait(_c.at_, _c.name_, _c.generics_, ff_core_List.List_map(definition_.constraints_, ((_w1) => {
1335
1449
  return ff_compiler_Resolver.Resolver_resolveConstraint(self2_, _w1, true)
1336
- })), _c.generatorParameters_, ff_core_List.List_map(definition_.methods_, ((_w1) => {
1450
+ })), _c.generatorParameters_, ff_compiler_Resolver.checkDuplicates_(ff_core_List.List_map(definition_.methods_, ((_w1) => {
1337
1451
  return ff_compiler_Resolver.Resolver_resolveSignature(self2_, _w1, true, false)
1452
+ })), ((_w1) => {
1453
+ return _w1.name_
1454
+ }), ((_w1) => {
1455
+ return _w1.at_
1338
1456
  })), ff_core_List.List_map(definition_.methodDefaults_, ((_1) => {
1339
1457
  {
1340
1458
  const name_ = _1.first_;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "description": "Firefly compiler",
5
5
  "author": "Firefly team",
6
6
  "license": "MIT",
7
- "version": "0.5.42",
7
+ "version": "0.5.44",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Ahnfelt/firefly-boot"
@@ -4,7 +4,7 @@
4
4
  "description": "Firefly language support",
5
5
  "author": "Firefly team",
6
6
  "license": "MIT",
7
- "version": "0.5.42",
7
+ "version": "0.5.44",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Ahnfelt/firefly-boot"
@@ -491,9 +491,9 @@ extend self: WebRequest[WebResponse] {
491
491
  self.internalJsResponse->cork(Js->{
492
492
  self.internalJsResponse->upgrade(
493
493
  userData
494
- self.internalHeaders.grab("sec-websocket-key")
495
- self.internalHeaders.grab("sec-websocket-protocol")
496
- self.internalHeaders.grab("sec-websocket-extensions")
494
+ Js.orUndefined(self.internalHeaders.get("sec-websocket-key"))
495
+ Js.orUndefined(self.internalHeaders.get("sec-websocket-protocol"))
496
+ Js.orUndefined(self.internalHeaders.get("sec-websocket-extensions"))
497
497
  self.internalJsContext
498
498
  )
499
499
  })