firefly-compiler 0.4.20 → 0.4.21

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.
Files changed (62) hide show
  1. package/compiler/Builder.ff +23 -13
  2. package/compiler/JsEmitter.ff +120 -76
  3. package/compiler/LspHook.ff +4 -2
  4. package/compiler/Main.ff +13 -7
  5. package/compiler/Resolver.ff +15 -15
  6. package/compiler/Syntax.ff +1 -0
  7. package/core/Array.ff +6 -4
  8. package/core/Int.ff +12 -12
  9. package/core/List.ff +6 -4
  10. package/experimental/benchmarks/ListGrab.ff +23 -0
  11. package/experimental/benchmarks/ListGrab.java +55 -0
  12. package/experimental/benchmarks/Pyrotek45.ff +30 -0
  13. package/experimental/benchmarks/Pyrotek45.java +64 -0
  14. package/experimental/tests/TestJson.ff +26 -0
  15. package/lsp/Handler.ff +55 -59
  16. package/lsp/SignatureHelpHandler.ff +5 -4
  17. package/lsp/TestReferences.ff +15 -0
  18. package/lsp/TestReferencesCase.ff +8 -0
  19. package/output/js/ff/compiler/Builder.mjs +50 -44
  20. package/output/js/ff/compiler/Dependencies.mjs +0 -2
  21. package/output/js/ff/compiler/Deriver.mjs +16 -140
  22. package/output/js/ff/compiler/Dictionaries.mjs +8 -222
  23. package/output/js/ff/compiler/Environment.mjs +12 -154
  24. package/output/js/ff/compiler/Inference.mjs +127 -1013
  25. package/output/js/ff/compiler/JsEmitter.mjs +434 -2344
  26. package/output/js/ff/compiler/JsImporter.mjs +0 -12
  27. package/output/js/ff/compiler/LspHook.mjs +20 -446
  28. package/output/js/ff/compiler/Main.mjs +96 -550
  29. package/output/js/ff/compiler/Parser.mjs +36 -356
  30. package/output/js/ff/compiler/Patterns.mjs +20 -200
  31. package/output/js/ff/compiler/Resolver.mjs +26 -340
  32. package/output/js/ff/compiler/Substitution.mjs +2 -160
  33. package/output/js/ff/compiler/Syntax.mjs +449 -3293
  34. package/output/js/ff/compiler/Token.mjs +9 -1095
  35. package/output/js/ff/compiler/Tokenizer.mjs +4 -2
  36. package/output/js/ff/compiler/Unification.mjs +26 -360
  37. package/output/js/ff/compiler/Wildcards.mjs +0 -86
  38. package/output/js/ff/compiler/Workspace.mjs +8 -96
  39. package/output/js/ff/core/Array.mjs +15 -8
  40. package/output/js/ff/core/AssetSystem.mjs +4 -14
  41. package/output/js/ff/core/Bool.mjs +0 -12
  42. package/output/js/ff/core/Core.mjs +0 -30
  43. package/output/js/ff/core/Int.mjs +24 -24
  44. package/output/js/ff/core/IntMap.mjs +0 -8
  45. package/output/js/ff/core/Json.mjs +0 -40
  46. package/output/js/ff/core/List.mjs +23 -32
  47. package/output/js/ff/core/Lock.mjs +0 -10
  48. package/output/js/ff/core/Map.mjs +0 -24
  49. package/output/js/ff/core/Option.mjs +10 -286
  50. package/output/js/ff/core/Ordering.mjs +16 -158
  51. package/output/js/ff/core/Pair.mjs +2 -34
  52. package/output/js/ff/core/Path.mjs +2 -28
  53. package/output/js/ff/core/Random.mjs +4 -4
  54. package/output/js/ff/core/RbMap.mjs +56 -644
  55. package/output/js/ff/core/Show.mjs +0 -16
  56. package/output/js/ff/core/Stream.mjs +14 -144
  57. package/output/js/ff/core/StringMap.mjs +0 -8
  58. package/output/js/ff/core/Try.mjs +4 -108
  59. package/output/js/ff/core/Unit.mjs +2 -16
  60. package/package.json +1 -1
  61. package/postgresql/Pg.ff +23 -23
  62. package/vscode/package.json +1 -1
@@ -124,20 +124,14 @@ return ((("ff:core/" + name_) + ".") + name_)
124
124
  export function constraintsToInstances_(constraints_) {
125
125
  return ff_core_List.List_toMap(ff_core_List.List_map(constraints_, ((c_) => {
126
126
  const typeName_ = (((_1) => {
127
- {
128
127
  if(_1.TConstructor) {
129
128
  const name_ = _1.name_;
130
129
  return name_
131
- return
132
130
  }
133
- }
134
- {
135
131
  if(_1.TVariable) {
136
132
  const at_ = _1.at_;
137
133
  const i_ = _1.index_;
138
134
  return ff_compiler_Inference.fail_(c_.at_, ("Unexpected unification variable: $" + i_))
139
- return
140
- }
141
135
  }
142
136
  }))(ff_core_List.List_grabFirst(c_.generics_));
143
137
  return ff_core_Pair.Pair(ff_compiler_Unification.InstanceKey(c_.name_, typeName_), ff_compiler_Unification.InstanceValue([], [], ff_compiler_Syntax.PackagePair("", ""), "", c_.name_, c_.generics_))
@@ -159,20 +153,14 @@ return ((("ff:core/" + name_) + ".") + name_)
159
153
  export async function constraintsToInstances_$(constraints_, $task) {
160
154
  return ff_core_List.List_toMap(ff_core_List.List_map(constraints_, ((c_) => {
161
155
  const typeName_ = (((_1) => {
162
- {
163
156
  if(_1.TConstructor) {
164
157
  const name_ = _1.name_;
165
158
  return name_
166
- return
167
159
  }
168
- }
169
- {
170
160
  if(_1.TVariable) {
171
161
  const at_ = _1.at_;
172
162
  const i_ = _1.index_;
173
163
  return ff_compiler_Inference.fail_(c_.at_, ("Unexpected unification variable: $" + i_))
174
- return
175
- }
176
164
  }
177
165
  }))(ff_core_List.List_grabFirst(c_.generics_));
178
166
  return ff_core_Pair.Pair(ff_compiler_Unification.InstanceKey(c_.name_, typeName_), ff_compiler_Unification.InstanceValue([], [], ff_compiler_Syntax.PackagePair("", ""), "", c_.name_, c_.generics_))
@@ -209,7 +197,6 @@ const _1 = definition_;
209
197
  {
210
198
  const _c = _1;
211
199
  return ff_compiler_Syntax.DTrait(_c.at_, _c.name_, _c.generics_, _c.constraints_, _c.generatorParameters_, _c.methods_, _c.methodDefaults_, _c.methodGenerators_)
212
- return
213
200
  }
214
201
  }
215
202
  }
@@ -257,7 +244,6 @@ const _1 = p_;
257
244
  {
258
245
  const _c = _1;
259
246
  return ff_compiler_Syntax.Parameter(_c.at_, _c.mutable_, _c.name_, ff_compiler_Unification.Unification_instantiate(self_.unification_, instantiationMap_, p_.valueType_), _c.default_)
260
- return
261
247
  }
262
248
  }
263
249
  }));
@@ -298,7 +284,6 @@ const _1 = definition_;
298
284
  {
299
285
  const _c = _1;
300
286
  return ff_compiler_Syntax.DLet(_c.at_, _c.name_, _c.variableType_, value_)
301
- return
302
287
  }
303
288
  }
304
289
  }
@@ -320,7 +305,6 @@ const _1 = case_;
320
305
  {
321
306
  const _c = _1;
322
307
  return ff_compiler_Syntax.MatchCase(_c.at_, [ff_compiler_Syntax.PVariable(method_.at_, ff_core_Option.None()), ...case_.patterns_], _c.guards_, _c.body_)
323
- return
324
308
  }
325
309
  }
326
310
  })))
@@ -340,7 +324,6 @@ const _1 = definition_;
340
324
  {
341
325
  const _c = _1;
342
326
  return ff_compiler_Syntax.DExtend(_c.at_, _c.name_, _c.generics_, _c.constraints_, _c.type_, functions_)
343
- return
344
327
  }
345
328
  }
346
329
  }
@@ -383,35 +366,25 @@ return
383
366
  export function Inference_inferLambda(self_, environment_, expected_, lambda_) {
384
367
  const unitName_ = ff_compiler_Inference.core_("Unit");
385
368
  const returnsUnit_ = (((_1) => {
386
- {
387
369
  if(_1.TConstructor) {
388
370
  const name_ = _1.name_;
389
371
  const ts_ = _1.generics_;
390
- const _guard1 = ff_core_String.String_startsWith(name_, "Function$", 0);
391
- if(_guard1) {
372
+ if(ff_core_String.String_startsWith(name_, "Function$", 0)) {
392
373
  {
393
374
  const _1 = ff_core_List.List_grabLast(ts_);
394
- {
395
- if(_1.TConstructor) {
375
+ if(_1.TConstructor && _1.generics_.length === 0) {
396
376
  const n_ = _1.name_;
397
- if(_1.generics_.length === 0) {
398
377
  return (n_ === unitName_)
399
- return
400
- }
401
- }
402
378
  }
403
379
  {
404
380
  return false
405
- return
406
381
  }
407
382
  }
408
383
  return
409
384
  }
410
385
  }
411
- }
412
386
  {
413
387
  return false
414
- return
415
388
  }
416
389
  }))(ff_compiler_Unification.Unification_substitute(self_.unification_, expected_));
417
390
  const cases_ = ((!returnsUnit_)
@@ -422,7 +395,6 @@ const _1 = c_;
422
395
  {
423
396
  const _c = _1;
424
397
  return ff_compiler_Syntax.MatchCase(_c.at_, _c.patterns_, _c.guards_, ff_compiler_Syntax.ESequential(c_.at_, c_.body_, ff_compiler_Syntax.EVariant(c_.at_, unitName_, [], ff_core_Option.None())))
425
- return
426
398
  }
427
399
  }
428
400
  })));
@@ -460,7 +432,6 @@ const at_ = _2.first_;
460
432
  const type_ = _2.second_;
461
433
  const noEffect_ = ff_compiler_Syntax.TConstructor(at_, "ff:core/Nothing.Nothing", []);
462
434
  return ff_compiler_Environment.Scheme(true, false, false, false, ff_compiler_Syntax.Signature(at_, name_, false, [], [], [], type_, noEffect_))
463
- return
464
435
  }
465
436
  }), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
466
437
  {
@@ -468,7 +439,6 @@ const _1 = environment_;
468
439
  {
469
440
  const _c = _1;
470
441
  return ff_compiler_Environment.Environment(_c.modulePrefix_, ff_core_Map.Map_addAll(environment1_.symbols_, symbols_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), _c.traits_, _c.imports_, _c.effect_, _c.selfVariable_)
471
- return
472
442
  }
473
443
  }
474
444
  return
@@ -485,7 +455,6 @@ const at_ = _2.first_;
485
455
  const type_ = _2.second_;
486
456
  const noEffect_ = ff_compiler_Syntax.TConstructor(at_, "ff:core/Nothing.Nothing", []);
487
457
  return ff_compiler_Environment.Scheme(true, false, false, false, ff_compiler_Syntax.Signature(at_, name_, false, [], [], [], type_, noEffect_))
488
- return
489
458
  }
490
459
  }), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
491
460
  ff_core_Array.Array_push(guards_, (((_c) => {
@@ -496,7 +465,6 @@ const _1 = environment2_;
496
465
  {
497
466
  const _c = _1;
498
467
  return ff_compiler_Environment.Environment(_c.modulePrefix_, ff_core_Map.Map_addAll(environment2_.symbols_, symbols_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), _c.traits_, _c.imports_, _c.effect_, _c.selfVariable_)
499
- return
500
468
  }
501
469
  }
502
470
  }));
@@ -505,7 +473,6 @@ const _1 = case_;
505
473
  {
506
474
  const _c = _1;
507
475
  return ff_compiler_Syntax.MatchCase(_c.at_, _c.patterns_, ff_core_Array.Array_drain(guards_), ff_compiler_Inference.Inference_inferTerm(self_, environment3_, returnType_, case_.body_))
508
- return
509
476
  }
510
477
  }
511
478
  }
@@ -513,24 +480,17 @@ return
513
480
  export function Inference_inferPattern(self_, environment_, expected_, pattern_) {
514
481
  if(ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) {
515
482
  if((((_1) => {
516
- {
517
483
  if(_1.PVariantAs) {
518
484
  const at_ = _1.at_;
519
485
  const variableAt_ = _1.variableAt_;
520
486
  return ((ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, at_) || ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, variableAt_)) || ff_compiler_LspHook.LspHook_isDefinedAt(self_.lspHook_, variableAt_))
521
- return
522
487
  }
523
- }
524
- {
525
488
  if(_1.PAlias) {
526
489
  const at_ = _1.at_;
527
490
  return (ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, at_) || ff_compiler_LspHook.LspHook_isDefinedAt(self_.lspHook_, at_))
528
- return
529
- }
530
491
  }
531
492
  {
532
493
  return ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, pattern_.at_)
533
- return
534
494
  }
535
495
  }))(pattern_)) {
536
496
  ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferPatternHook(self_.unification_, environment_, expected_, pattern_))
@@ -542,53 +502,30 @@ return ff_core_Map.empty_()
542
502
  }
543
503
  {
544
504
  const _1 = pattern_;
545
- {
546
505
  if(_1.PString) {
547
506
  return literal_("String")
548
- return
549
- }
550
507
  }
551
- {
552
508
  if(_1.PInt) {
553
509
  return literal_("Int")
554
- return
555
510
  }
556
- }
557
- {
558
511
  if(_1.PChar) {
559
512
  return literal_("Char")
560
- return
561
- }
562
513
  }
563
- {
564
- if(_1.PVariable) {
514
+ if(_1.PVariable && _1.name_.None) {
565
515
  const at_ = _1.at_;
566
- if(_1.name_.None) {
567
516
  return ff_core_Map.empty_()
568
- return
569
- }
570
517
  }
571
- }
572
- {
573
- if(_1.PVariable) {
518
+ if(_1.PVariable && _1.name_.Some) {
574
519
  const at_ = _1.at_;
575
- if(_1.name_.Some) {
576
520
  const name_ = _1.name_.value_;
577
521
  return ff_core_List.List_toMap([ff_core_Pair.Pair(name_, ff_core_Pair.Pair(at_, expected_))], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
578
- return
579
522
  }
580
- }
581
- }
582
- {
583
523
  if(_1.PAlias) {
584
524
  const at_ = _1.at_;
585
525
  const pattern_ = _1.pattern_;
586
526
  const variable_ = _1.variable_;
587
527
  return ff_core_Map.Map_add(ff_compiler_Inference.Inference_inferPattern(self_, environment_, expected_, pattern_), variable_, ff_core_Pair.Pair(at_, expected_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
588
- return
589
528
  }
590
- }
591
- {
592
529
  if(_1.PVariantAs) {
593
530
  const at_ = _1.at_;
594
531
  const name_ = _1.name_;
@@ -614,44 +551,24 @@ return ff_core_Pair.Pair(_w1, ff_core_Pair.Pair(variableAt_, recordType_))
614
551
  })), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
615
552
  return
616
553
  }
617
- }
618
- {
619
- if(_1.PVariant) {
554
+ if(_1.PVariant && _1.name_ === "List$Empty" && _1.patterns_.length === 0) {
620
555
  const at_ = _1.at_;
621
- if(_1.name_ === "List$Empty") {
622
- if(_1.patterns_.length === 0) {
623
556
  const itemType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, at_);
624
557
  const listType_ = ff_compiler_Syntax.TConstructor(at_, ff_compiler_Inference.core_("List"), [itemType_]);
625
558
  ff_compiler_Unification.Unification_unify(self_.unification_, at_, expected_, listType_);
626
559
  return ff_core_List.List_toMap([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
627
- return
628
- }
629
- }
630
560
  }
631
- }
632
- {
633
- if(_1.PVariant) {
561
+ if(_1.PVariant && _1.name_ === "List$Link" && _1.patterns_.length === 2) {
634
562
  const at_ = _1.at_;
635
- if(_1.name_ === "List$Link") {
636
- if(_1.patterns_.length > 0) {
637
563
  const head_ = _1.patterns_[0];
638
- if(_1.patterns_.length > 1) {
639
564
  const tail_ = _1.patterns_[1];
640
- if(_1.patterns_.length === 2) {
641
565
  const itemType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, at_);
642
566
  const listType_ = ff_compiler_Syntax.TConstructor(at_, ff_compiler_Inference.core_("List"), [itemType_]);
643
567
  ff_compiler_Unification.Unification_unify(self_.unification_, at_, expected_, listType_);
644
568
  const headVariables_ = ff_compiler_Inference.Inference_inferPattern(self_, environment_, itemType_, head_);
645
569
  const tailVariables_ = ff_compiler_Inference.Inference_inferPattern(self_, environment_, listType_, tail_);
646
570
  return ff_core_Map.Map_addAll(headVariables_, tailVariables_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
647
- return
648
571
  }
649
- }
650
- }
651
- }
652
- }
653
- }
654
- {
655
572
  if(_1.PVariant) {
656
573
  const at_ = _1.at_;
657
574
  const name_ = _1.name_;
@@ -668,7 +585,6 @@ return ff_core_List.List_foldLeft(ff_core_List.List_map(ff_core_List.List_zip(pa
668
585
  const pattern_ = _1.first_;
669
586
  const parameter_ = _1.second_;
670
587
  return ff_compiler_Inference.Inference_inferPattern(self_, environment_, parameter_.valueType_, pattern_)
671
- return
672
588
  }
673
589
  })), ff_core_Map.empty_(), ((_w1, _w2) => {
674
590
  return ff_core_Map.Map_addAll(_w1, _w2, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
@@ -677,7 +593,6 @@ return
677
593
  }
678
594
  }
679
595
  }
680
- }
681
596
 
682
597
  export function Inference_inferTerm(self_, environment_, expected_, term_) {
683
598
  const hookRecordTypeBox_ = (ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, term_.at_)
@@ -693,31 +608,18 @@ return term_
693
608
  }
694
609
  {
695
610
  const _1 = term_;
696
- {
697
611
  if(_1.EString) {
698
612
  return literal_("String")
699
- return
700
613
  }
701
- }
702
- {
703
614
  if(_1.EChar) {
704
615
  return literal_("Char")
705
- return
706
- }
707
616
  }
708
- {
709
617
  if(_1.EInt) {
710
618
  return literal_("Int")
711
- return
712
619
  }
713
- }
714
- {
715
620
  if(_1.EFloat) {
716
621
  return literal_("Float")
717
- return
718
- }
719
622
  }
720
- {
721
623
  if(_1.EVariable) {
722
624
  const e_ = _1;
723
625
  return ff_core_Option.Option_else(ff_core_Option.Option_map(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, e_.name_, [], ff_core_Option.None()), ((instantiated_) => {
@@ -732,8 +634,6 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Sy
732
634
  }))
733
635
  return
734
636
  }
735
- }
736
- {
737
637
  if(_1.EField) {
738
638
  const e_ = _1;
739
639
  const recordType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
@@ -745,13 +645,11 @@ _w1.value_ = ff_core_Option.Some(recordType_)
745
645
  const record_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, recordType_, e_.record_);
746
646
  {
747
647
  const _1 = ff_compiler_Unification.Unification_substitute(self_.unification_, recordType_);
748
- {
749
- const t_ = _1;
750
648
  if(_1.TConstructor) {
649
+ const t_ = _1;
751
650
  const name_ = _1.name_;
752
651
  const typeArguments_ = _1.generics_;
753
- const _guard1 = ff_core_String.String_startsWith(name_, "Record$", 0);
754
- if(_guard1) {
652
+ if(ff_core_String.String_startsWith(name_, "Record$", 0)) {
755
653
  if(ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, e_.at_)) {
756
654
  const symbolHook_ = ff_compiler_LspHook.SymbolHook(e_.field_, e_.at_, e_.at_);
757
655
  const noEffect_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
@@ -763,14 +661,13 @@ return (_w1.second_ === e_.field_)
763
661
  })), ((_w1) => {
764
662
  return _w1.first_
765
663
  })), ((index_) => {
766
- const t1_ = ff_core_List.List_grab(typeArguments_, index_);
664
+ const t1_ = (typeArguments_[index_] ?? ff_core_List.internalGrab_(typeArguments_, index_));
767
665
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t1_);
768
666
  {
769
667
  const _1 = e_;
770
668
  {
771
669
  const _c = _1;
772
670
  return ff_compiler_Syntax.EField(_c.at_, _c.newtype_, record_, _c.field_)
773
- return
774
671
  }
775
672
  }
776
673
  })), (() => {
@@ -783,31 +680,24 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Sy
783
680
  return
784
681
  }
785
682
  }
786
- }
787
- {
788
- const t_ = _1;
789
683
  if(_1.TConstructor) {
684
+ const t_ = _1;
790
685
  const name_ = _1.name_;
791
686
  const typeArguments_ = _1.generics_;
792
687
  const memberPrefix_ = (name_ + "_");
793
688
  const memberName_ = (memberPrefix_ + e_.field_);
794
689
  {
795
690
  const _1 = ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, memberName_, typeArguments_, ff_core_Option.None());
796
- {
797
691
  if(_1.Some) {
798
692
  const instantiated_ = _1.value_;
799
- const _guard1 = (!instantiated_.scheme_.isVariable_);
800
- if(_guard1) {
693
+ if((!instantiated_.scheme_.isVariable_)) {
801
694
  const signature_ = (((_c) => {
802
695
  return ff_compiler_Syntax.Signature(_c.at_, _c.name_, _c.member_, _c.generics_, _c.constraints_, ff_core_List.List_dropFirst(instantiated_.scheme_.signature_.parameters_, 1), _c.returnType_, _c.effect_)
803
696
  }))(instantiated_.scheme_.signature_);
804
697
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, recordType_, ff_core_List.List_grab(instantiated_.scheme_.signature_.parameters_, 0).valueType_);
805
698
  return ff_compiler_Inference.Inference_inferEtaExpansion(self_, environment_, expected_, e_.at_, signature_, term_)
806
- return
807
- }
808
699
  }
809
700
  }
810
- {
811
701
  if(_1.Some) {
812
702
  const instantiated_ = _1.value_;
813
703
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, instantiated_.scheme_.signature_.returnType_);
@@ -816,43 +706,26 @@ const _1 = e_;
816
706
  {
817
707
  const _c = _1;
818
708
  return ff_compiler_Syntax.EField(_c.at_, instantiated_.scheme_.isNewtype_, record_, _c.field_)
819
- return
820
709
  }
821
710
  }
822
711
  return
823
712
  }
824
- }
825
- {
826
713
  if(_1.None) {
827
714
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(e_.at_, ((("No such field " + e_.field_) + " on type: ") + ff_compiler_Syntax.Type_show(t_, []))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
828
- return
829
- }
830
715
  }
831
716
  }
832
717
  return
833
718
  }
834
- }
835
- {
836
- if(_1.TVariable) {
837
- const _guard1 = ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_);
838
- if(_guard1) {
719
+ if(_1.TVariable && ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) {
839
720
  return term_
840
- return
841
721
  }
842
- }
843
- }
844
- {
845
722
  if(_1.TVariable) {
846
723
  const index_ = _1.index_;
847
724
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(e_.at_, ((("No such field " + e_.field_) + " on unknown type: $") + index_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
848
- return
849
- }
850
725
  }
851
726
  }
852
727
  return
853
728
  }
854
- }
855
- {
856
729
  if(_1.EWildcard) {
857
730
  const e_ = _1;
858
731
  return ff_core_Option.Option_grab(ff_core_Option.Option_map(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, ("_w" + e_.index_), [], ff_core_Option.None()), ((instantiated_) => {
@@ -861,8 +734,6 @@ return term_
861
734
  })))
862
735
  return
863
736
  }
864
- }
865
- {
866
737
  if(_1.EList) {
867
738
  const at_ = _1.at_;
868
739
  const t_ = _1.elementType_;
@@ -881,8 +752,6 @@ return
881
752
  })))
882
753
  return
883
754
  }
884
- }
885
- {
886
755
  if(_1.ESequential) {
887
756
  const at_ = _1.at_;
888
757
  const before_ = _1.before_;
@@ -893,12 +762,10 @@ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferSequen
893
762
  const newExpected_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, at_);
894
763
  {
895
764
  const _1 = before_;
896
- {
897
- if(_1.EPipe) {
765
+ if(_1.EPipe && _1.function_.ELambda) {
898
766
  const at1_ = _1.at_;
899
767
  const value_ = _1.value_;
900
768
  const effect1_ = _1.effect_;
901
- if(_1.function_.ELambda) {
902
769
  const at2_ = _1.function_.at_;
903
770
  const at3_ = _1.function_.lambda_.at_;
904
771
  const effect3_ = _1.function_.lambda_.effect_;
@@ -910,42 +777,30 @@ const _1 = case_;
910
777
  {
911
778
  const _c = _1;
912
779
  return ff_compiler_Syntax.MatchCase(_c.at_, _c.patterns_, _c.guards_, ff_compiler_Syntax.ESequential(case_.at_, case_.body_, e_))
913
- return
914
780
  }
915
781
  }
916
782
  }));
917
783
  const newPipe_ = ff_compiler_Syntax.EPipe(at1_, value_, effect1_, ff_compiler_Syntax.ELambda(at2_, ff_compiler_Syntax.Lambda(at3_, effect3_, newCases_)));
918
784
  {
919
785
  const _1 = after_;
920
- {
921
- if(_1.EVariant) {
786
+ if(_1.EVariant && _1.name_ === "ff:core/Unit.Unit") {
922
787
  const at_ = _1.at_;
923
- if(_1.name_ === "ff:core/Unit.Unit") {
924
788
  const unitType_ = ff_compiler_Syntax.TConstructor(at_, ff_compiler_Inference.core_("Unit"), []);
925
789
  ff_compiler_Unification.Unification_unify(self_.unification_, at_, expected_, unitType_);
926
790
  return ff_compiler_Inference.Inference_inferTerm(self_, environment_, newExpected_, newPipe_)
927
- return
928
- }
929
- }
930
791
  }
931
792
  {
932
793
  return ff_compiler_Syntax.ESequential(at_, ff_compiler_Inference.Inference_inferTerm(self_, environment_, newExpected_, newPipe_), ff_compiler_Inference.Inference_inferTerm(self_, environment_, expected_, after_))
933
- return
934
794
  }
935
795
  }
936
796
  return
937
797
  }
938
- }
939
- }
940
798
  {
941
799
  return ff_compiler_Syntax.ESequential(at_, ff_compiler_Inference.Inference_inferTerm(self_, environment_, newExpected_, before_), ff_compiler_Inference.Inference_inferTerm(self_, environment_, expected_, after_))
942
- return
943
800
  }
944
801
  }
945
802
  return
946
803
  }
947
- }
948
- {
949
804
  if(_1.ELet) {
950
805
  const e_ = _1;
951
806
  const noEffect_ = ff_compiler_Syntax.TConstructor(e_.at_, "ff:core/Nothing.Nothing", []);
@@ -958,64 +813,29 @@ const _1 = e_;
958
813
  {
959
814
  const _c = _1;
960
815
  return ff_compiler_Syntax.ELet(_c.at_, _c.mutable_, _c.name_, _c.valueType_, ff_compiler_Inference.Inference_inferTerm(self_, environment_, e_.valueType_, e_.value_), ff_compiler_Inference.Inference_inferTerm(self_, environment2_, expected_, e_.body_))
961
- return
962
816
  }
963
817
  }
964
818
  return
965
819
  }
966
- }
967
- {
968
820
  if(_1.ELambda) {
969
821
  const at_ = _1.at_;
970
822
  const l_ = _1.lambda_;
971
823
  do {
972
824
  const _1 = l_.cases_;
973
- {
974
- if(_1.length > 0) {
975
- if(_1[0].patterns_.length === 0) {
976
- if(_1[0].guards_.length === 0) {
977
- if(_1[0].body_.EVariable) {
825
+ if(_1.length === 1 && _1[0].patterns_.length === 0 && _1[0].guards_.length === 0 && _1[0].body_.EVariable && _1[0].body_.name_ === "") {
978
826
  const insideAt_ = _1[0].body_.at_;
979
- if(_1[0].body_.name_ === "") {
980
- if(_1.length === 1) {
981
- const _guard1 = ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, insideAt_);
982
- if(_guard1) {
827
+ if(ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, insideAt_)) {
983
828
  ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferLambdaStartHook(self_.unification_, environment_, expected_))
984
829
  break
985
830
  }
986
831
  }
987
- }
988
- }
989
- }
990
- }
991
- }
992
- }
993
- {
994
- if(_1.length > 0) {
995
- if(_1[0].patterns_.length === 0) {
996
- if(_1[0].guards_.length === 0) {
997
- if(_1[0].body_.ESequential) {
998
- if(_1[0].body_.before_.EVariable) {
832
+ if(_1.length === 1 && _1[0].patterns_.length === 0 && _1[0].guards_.length === 0 && _1[0].body_.ESequential && _1[0].body_.before_.EVariable && _1[0].body_.before_.name_ === "" && _1[0].body_.after_.EVariant && _1[0].body_.after_.name_ === "ff:core/Unit.Unit") {
999
833
  const insideAt_ = _1[0].body_.before_.at_;
1000
- if(_1[0].body_.before_.name_ === "") {
1001
- if(_1[0].body_.after_.EVariant) {
1002
- if(_1[0].body_.after_.name_ === "ff:core/Unit.Unit") {
1003
- if(_1.length === 1) {
1004
- const _guard1 = ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, insideAt_);
1005
- if(_guard1) {
834
+ if(ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, insideAt_)) {
1006
835
  ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferLambdaStartHook(self_.unification_, environment_, expected_))
1007
836
  break
1008
837
  }
1009
838
  }
1010
- }
1011
- }
1012
- }
1013
- }
1014
- }
1015
- }
1016
- }
1017
- }
1018
- }
1019
839
  {
1020
840
 
1021
841
  break
@@ -1023,10 +843,7 @@ break
1023
843
  } while(false);
1024
844
  const lambda_ = ff_compiler_Inference.Inference_inferLambda(self_, environment_, expected_, l_);
1025
845
  return ff_compiler_Syntax.ELambda(at_, lambda_)
1026
- return
1027
846
  }
1028
- }
1029
- {
1030
847
  if(_1.EVariant) {
1031
848
  const e_ = _1;
1032
849
  const instantiated_ = ff_core_Option.Option_else(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, e_.name_, e_.typeArguments_, e_.arguments_), (() => {
@@ -1048,8 +865,6 @@ return
1048
865
  }
1049
866
  return
1050
867
  }
1051
- }
1052
- {
1053
868
  if(_1.EVariantIs) {
1054
869
  const e_ = _1;
1055
870
  const instantiated_ = ff_core_Option.Option_else(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, e_.name_, e_.typeArguments_, ff_core_Option.None()), (() => {
@@ -1077,8 +892,6 @@ return
1077
892
  }
1078
893
  return
1079
894
  }
1080
- }
1081
- {
1082
895
  if(_1.ECopy) {
1083
896
  const e_ = _1;
1084
897
  const scheme_ = ff_core_Option.Option_else(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, e_.name_, [], ff_core_Option.None()), (() => {
@@ -1105,7 +918,6 @@ const _1 = f_;
1105
918
  {
1106
919
  const _c = _1;
1107
920
  return ff_compiler_Syntax.Argument(_c.at_, ff_core_Option.Some(f_.name_), _c.value_)
1108
- return
1109
921
  }
1110
922
  }
1111
923
  }));
@@ -1128,7 +940,6 @@ const at_ = _1.at_;
1128
940
  const name_ = _1.name_;
1129
941
  const value_ = _1.value_;
1130
942
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ("Unknown parameter: " + name_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1131
- return
1132
943
  }
1133
944
  }));
1134
945
  const arguments_ = ff_core_List.List_map(parameterNames_, ((name_) => {
@@ -1139,7 +950,6 @@ return (_w1.name_ === name_)
1139
950
  const at_ = _1.at_;
1140
951
  const value_ = _1.value_;
1141
952
  return ff_compiler_Syntax.Argument(at_, ff_core_Option.Some(name_), value_)
1142
- return
1143
953
  }
1144
954
  })), (() => {
1145
955
  const at_ = (((_c) => {
@@ -1152,10 +962,7 @@ const body_ = ff_compiler_Syntax.EVariant(e_.at_, e_.name_, [], ff_core_Option.S
1152
962
  const effect_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
1153
963
  const e1_ = ff_compiler_Syntax.EPipe(e_.at_, e_.record_, effect_, ff_compiler_Syntax.ELambda(e_.at_, ff_compiler_Syntax.Lambda(e_.at_, effect_, [ff_compiler_Syntax.MatchCase(e_.at_, [ff_compiler_Syntax.PVariable(e_.at_, ff_core_Option.Some("_c"))], [], body_)])));
1154
964
  return ff_compiler_Inference.Inference_inferTerm(self_, environment_, expected_, e1_)
1155
- return
1156
965
  }
1157
- }
1158
- {
1159
966
  if(_1.EPipe) {
1160
967
  const e_ = _1;
1161
968
  const valueType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
@@ -1168,47 +975,33 @@ const _1 = e_;
1168
975
  {
1169
976
  const _c = _1;
1170
977
  return ff_compiler_Syntax.EPipe(_c.at_, value_, _c.effect_, function_)
1171
- return
1172
978
  }
1173
979
  }
1174
980
  return
1175
981
  }
1176
- }
1177
- {
1178
982
  if(_1.ECall) {
1179
983
  const e_ = _1;
1180
984
  if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (((_1) => {
1181
- {
1182
985
  if(_1.StaticCall) {
1183
986
  return true
1184
- return
1185
- }
1186
987
  }
1187
988
  {
1188
989
  return false
1189
- return
1190
990
  }
1191
991
  }))(e_.target_))) {
1192
992
  return term_
1193
993
  } else {
1194
994
  const call_ = (((_1) => {
1195
- {
1196
995
  if(_1.DynamicCall) {
1197
996
  const call_ = _1;
1198
997
  return call_
1199
- return
1200
- }
1201
998
  }
1202
- {
1203
999
  if(_1.StaticCall) {
1204
1000
  return ff_compiler_Inference.fail_(e_.at_, "Internal error: Static calls not expected in the Inference phase")
1205
- return
1206
- }
1207
1001
  }
1208
1002
  }))(e_.target_);
1209
1003
  {
1210
1004
  const _1 = call_.function_;
1211
- {
1212
1005
  if(_1.EVariable) {
1213
1006
  const variableAt_ = _1.at_;
1214
1007
  const x_ = _1.name_;
@@ -1219,7 +1012,6 @@ return ff_compiler_Inference.Inference_inferOperator(self_, environment_, expect
1219
1012
  } else {
1220
1013
  {
1221
1014
  const _1 = ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, x_, e_.typeArguments_, ff_core_Option.Some(e_.arguments_));
1222
- {
1223
1015
  if(_1.Some) {
1224
1016
  const instantiated_ = _1.value_;
1225
1017
  if(instantiated_.scheme_.isVariable_) {
@@ -1230,19 +1022,13 @@ return ff_compiler_Inference.Inference_inferFunctionCall(self_, environment_, ex
1230
1022
  }
1231
1023
  return
1232
1024
  }
1233
- }
1234
- {
1235
1025
  if(_1.None) {
1236
1026
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(variableAt_, ("No such function: " + x_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1237
- return
1238
- }
1239
1027
  }
1240
1028
  }
1241
1029
  }
1242
1030
  return
1243
1031
  }
1244
- }
1245
- {
1246
1032
  if(_1.EField) {
1247
1033
  const f_ = _1;
1248
1034
  const recordType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, f_.at_);
@@ -1261,71 +1047,46 @@ return ff_compiler_Syntax.EField(_c.at_, _c.newtype_, record_, _c.field_)
1261
1047
  }))(e_);
1262
1048
  {
1263
1049
  const _1 = ff_compiler_Unification.Unification_substitute(self_.unification_, recordType_);
1264
- {
1265
- const t_ = _1;
1266
1050
  if(_1.TConstructor) {
1051
+ const t_ = _1;
1267
1052
  const name_ = _1.name_;
1268
1053
  const methodName_ = ((name_ + "_") + f_.field_);
1269
1054
  const arguments_ = [ff_compiler_Syntax.Argument(f_.record_.at_, ff_core_Option.None(), f_.record_), ...e_.arguments_];
1270
1055
  {
1271
1056
  const _1 = ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, f_.at_, methodName_, [], ff_core_Option.Some(arguments_));
1272
- {
1273
1057
  if(_1.Some) {
1274
1058
  const instantiated_ = _1.value_;
1275
- const _guard1 = (!instantiated_.scheme_.isVariable_);
1276
- if(_guard1) {
1059
+ if((!instantiated_.scheme_.isVariable_)) {
1277
1060
  return ff_compiler_Inference.Inference_inferMethodCall(self_, environment_, expected_, instantiated_.scheme_.signature_, instantiated_.typeArguments_, e2_, record_, recordType_, methodName_)
1278
- return
1279
1061
  }
1280
1062
  }
1281
- }
1282
- {
1283
1063
  if(_1.Some) {
1284
1064
  const instantiated_ = _1.value_;
1285
1065
  return ff_compiler_Inference.Inference_inferLambdaCall(self_, environment_, expected_, e2_)
1286
- return
1287
- }
1288
1066
  }
1289
- {
1290
1067
  if(_1.None) {
1291
1068
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(f_.at_, ((("No such field " + f_.field_) + " on type: ") + ff_compiler_Syntax.Type_show(t_, []))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1292
- return
1293
- }
1294
1069
  }
1295
1070
  }
1296
1071
  return
1297
1072
  }
1298
- }
1299
- {
1300
- if(_1.TVariable) {
1301
- const _guard1 = ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_);
1302
- if(_guard1) {
1073
+ if(_1.TVariable && ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) {
1303
1074
  return ff_compiler_Inference.Inference_inferLambdaCall(self_, environment_, expected_, e2_)
1304
- return
1305
- }
1306
1075
  }
1307
- }
1308
- {
1309
1076
  if(_1.TVariable) {
1310
1077
  const index_ = _1.index_;
1311
1078
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(f_.at_, ((("No such field " + f_.field_) + " on unknown type: $") + index_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1312
- return
1313
- }
1314
1079
  }
1315
1080
  }
1316
1081
  return
1317
1082
  }
1318
- }
1319
1083
  {
1320
1084
  return ff_compiler_Inference.Inference_inferLambdaCall(self_, environment_, expected_, term_)
1321
- return
1322
1085
  }
1323
1086
  }
1324
1087
  }
1325
1088
  return
1326
1089
  }
1327
- }
1328
- {
1329
1090
  if(_1.ERecord) {
1330
1091
  const e_ = _1;
1331
1092
  const fields_ = ff_core_List.List_sortBy(e_.fields_, ((_w1) => {
@@ -1347,7 +1108,6 @@ const _1 = field_;
1347
1108
  {
1348
1109
  const _c = _1;
1349
1110
  return ff_compiler_Syntax.Field(_c.at_, _c.name_, ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, field_.value_))
1350
- return
1351
1111
  }
1352
1112
  }
1353
1113
  return
@@ -1358,13 +1118,10 @@ const _1 = e_;
1358
1118
  {
1359
1119
  const _c = _1;
1360
1120
  return ff_compiler_Syntax.ERecord(_c.at_, newFields_)
1361
- return
1362
1121
  }
1363
1122
  }
1364
1123
  return
1365
1124
  }
1366
- }
1367
- {
1368
1125
  if(_1.EFunctions) {
1369
1126
  const at_ = _1.at_;
1370
1127
  const functions_ = _1.functions_;
@@ -1381,10 +1138,7 @@ return ff_compiler_Inference.Inference_inferFunctionDefinition(self_, environmen
1381
1138
  }));
1382
1139
  const newBody_ = ff_compiler_Inference.Inference_inferTerm(self_, environment2_, expected_, body_);
1383
1140
  return ff_compiler_Syntax.EFunctions(at_, newFunctions_, newBody_)
1384
- return
1385
- }
1386
1141
  }
1387
- {
1388
1142
  if(_1.EAssign) {
1389
1143
  const e_ = _1;
1390
1144
  return ff_core_Option.Option_else(ff_core_Option.Option_map(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, e_.variable_, [], ff_core_Option.None()), ((instantiated_) => {
@@ -1395,7 +1149,6 @@ const _1 = e_;
1395
1149
  {
1396
1150
  const _c = _1;
1397
1151
  return ff_compiler_Syntax.EAssign(_c.at_, _c.operator_, _c.variable_, value_)
1398
- return
1399
1152
  }
1400
1153
  }
1401
1154
  } else {
@@ -1406,91 +1159,63 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Sy
1406
1159
  }))
1407
1160
  return
1408
1161
  }
1409
- }
1410
- {
1411
1162
  if(_1.EAssignField) {
1412
1163
  const e_ = _1;
1413
1164
  const recordType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
1414
1165
  const record_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, recordType_, e_.record_);
1415
1166
  {
1416
1167
  const _1 = ff_compiler_Unification.Unification_substitute(self_.unification_, recordType_);
1417
- {
1418
- const t_ = _1;
1419
1168
  if(_1.TConstructor) {
1169
+ const t_ = _1;
1420
1170
  const name_ = _1.name_;
1421
1171
  const typeArguments_ = _1.generics_;
1422
- const _guard1 = ff_core_String.String_startsWith(name_, "Record$", 0);
1423
- if(_guard1) {
1172
+ if(ff_core_String.String_startsWith(name_, "Record$", 0)) {
1424
1173
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(e_.at_, ("Can't assign fields of anonymous records: " + e_.field_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1425
- return
1426
1174
  }
1427
1175
  }
1428
- }
1429
- {
1430
- const t_ = _1;
1431
1176
  if(_1.TConstructor) {
1177
+ const t_ = _1;
1432
1178
  const name_ = _1.name_;
1433
1179
  const typeArguments_ = _1.generics_;
1434
1180
  const methodName_ = ((name_ + "_") + e_.field_);
1435
1181
  {
1436
1182
  const _1 = ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, methodName_, typeArguments_, ff_core_Option.None());
1437
- {
1438
1183
  if(_1.Some) {
1439
1184
  const instantiated_ = _1.value_;
1440
- const _guard1 = (instantiated_.scheme_.isMutable_ || ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_));
1441
- if(_guard1) {
1185
+ if((instantiated_.scheme_.isMutable_ || ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_))) {
1442
1186
  const value_ = ff_compiler_Inference.Inference_inferAssignment(self_, environment_, expected_, e_.at_, e_.operator_, e_.value_, instantiated_.scheme_.signature_);
1443
1187
  {
1444
1188
  const _1 = e_;
1445
1189
  {
1446
1190
  const _c = _1;
1447
1191
  return ff_compiler_Syntax.EAssignField(_c.at_, _c.operator_, record_, _c.field_, value_)
1448
- return
1449
1192
  }
1450
1193
  }
1451
1194
  return
1452
1195
  }
1453
1196
  }
1454
- }
1455
- {
1456
1197
  if(_1.Some) {
1457
1198
  const instantiated_ = _1.value_;
1458
1199
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(e_.at_, ((("Can't assign an immutable field " + e_.field_) + " on type: ") + ff_compiler_Syntax.Type_show(t_, []))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1459
- return
1460
1200
  }
1461
- }
1462
- {
1463
1201
  if(_1.None) {
1464
1202
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(e_.at_, ((("No such field " + e_.field_) + " on type: ") + ff_compiler_Syntax.Type_show(t_, []))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1465
- return
1466
- }
1467
1203
  }
1468
1204
  }
1469
1205
  return
1470
1206
  }
1207
+ if(_1.TVariable && ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) {
1208
+ return term_
1471
1209
  }
1472
- {
1473
1210
  if(_1.TVariable) {
1474
- const _guard1 = ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_);
1475
- if(_guard1) {
1476
- return term_
1477
- return
1478
- }
1479
- }
1480
- }
1481
- {
1482
- if(_1.TVariable) {
1483
- const index_ = _1.index_;
1484
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(e_.at_, ((("No such field " + e_.field_) + " on unknown type: $") + index_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1485
- return
1486
- }
1211
+ const index_ = _1.index_;
1212
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(e_.at_, ((("No such field " + e_.field_) + " on unknown type: $") + index_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1487
1213
  }
1488
1214
  }
1489
1215
  return
1490
1216
  }
1491
1217
  }
1492
1218
  }
1493
- }
1494
1219
 
1495
1220
  export function Inference_inferAssignment(self_, environment_, expected_, at_, operator_, value_, signature_) {
1496
1221
  const t_ = signature_.returnType_;
@@ -1506,31 +1231,21 @@ return newValue_
1506
1231
 
1507
1232
  export function Inference_inferMethodCall(self_, environment_, expected_, signature_, instantiation_, term_, record_, recordType_, name_) {
1508
1233
  const e_ = (((_1) => {
1509
- {
1510
1234
  if(_1.ECall) {
1511
1235
  const e_ = _1;
1512
1236
  return e_
1513
- return
1514
- }
1515
1237
  }
1516
1238
  {
1517
1239
  return ff_compiler_Inference.fail_(term_.at_, "Call expected")
1518
- return
1519
1240
  }
1520
1241
  }))(term_);
1521
1242
  const call_ = (((_1) => {
1522
- {
1523
1243
  if(_1.DynamicCall) {
1524
1244
  const call_ = _1;
1525
1245
  return call_
1526
- return
1527
1246
  }
1528
- }
1529
- {
1530
1247
  if(_1.StaticCall) {
1531
1248
  return ff_compiler_Inference.fail_(e_.at_, "Internal error: Static calls not expected in inferMethodCall")
1532
- return
1533
- }
1534
1249
  }
1535
1250
  }))(e_.target_);
1536
1251
  const selfParameter_ = ff_core_List.List_grabFirst(signature_.parameters_);
@@ -1553,31 +1268,21 @@ return
1553
1268
 
1554
1269
  export function Inference_inferFunctionCall(self_, environment_, expected_, signature_, instanceCall_, instantiation_, term_, name_) {
1555
1270
  const e_ = (((_1) => {
1556
- {
1557
1271
  if(_1.ECall) {
1558
1272
  const e_ = _1;
1559
1273
  return e_
1560
- return
1561
- }
1562
1274
  }
1563
1275
  {
1564
1276
  return ff_compiler_Inference.fail_(term_.at_, "Call expected")
1565
- return
1566
1277
  }
1567
1278
  }))(term_);
1568
1279
  const call_ = (((_1) => {
1569
- {
1570
1280
  if(_1.DynamicCall) {
1571
1281
  const call_ = _1;
1572
1282
  return call_
1573
- return
1574
1283
  }
1575
- }
1576
- {
1577
1284
  if(_1.StaticCall) {
1578
1285
  return ff_compiler_Inference.fail_(e_.at_, "Internal error: Static calls not expected in inferFunctionCall")
1579
- return
1580
- }
1581
1286
  }
1582
1287
  }))(e_.target_);
1583
1288
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, signature_.returnType_);
@@ -1597,40 +1302,26 @@ return
1597
1302
 
1598
1303
  export function Inference_inferLambdaCall(self_, environment_, expected_, term_) {
1599
1304
  const e_ = (((_1) => {
1600
- {
1601
1305
  if(_1.ECall) {
1602
1306
  const e_ = _1;
1603
1307
  return e_
1604
- return
1605
- }
1606
1308
  }
1607
1309
  {
1608
1310
  return ff_compiler_Inference.fail_(term_.at_, "Call expected")
1609
- return
1610
1311
  }
1611
1312
  }))(term_);
1612
1313
  const call_ = (((_1) => {
1613
- {
1614
1314
  if(_1.DynamicCall) {
1615
1315
  const call_ = _1;
1616
- const _guard1 = (!call_.tailCall_);
1617
- if(_guard1) {
1316
+ if((!call_.tailCall_)) {
1618
1317
  return call_
1619
- return
1620
1318
  }
1621
1319
  }
1622
- }
1623
- {
1624
1320
  if(_1.DynamicCall) {
1625
1321
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(e_.at_, "Tailcalls not supported on lambda functions"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1626
- return
1627
- }
1628
1322
  }
1629
- {
1630
1323
  if(_1.StaticCall) {
1631
1324
  return ff_compiler_Inference.fail_(e_.at_, "Internal error: Static calls not expected in inferLambdaCall")
1632
- return
1633
- }
1634
1325
  }
1635
1326
  }))(e_.target_);
1636
1327
  const effect_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, term_.at_);
@@ -1651,7 +1342,6 @@ const _1 = argument_;
1651
1342
  {
1652
1343
  const _c = _1;
1653
1344
  return ff_compiler_Syntax.Argument(_c.at_, _c.name_, ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, argument_.value_))
1654
- return
1655
1345
  }
1656
1346
  }
1657
1347
  return
@@ -1675,27 +1365,20 @@ return
1675
1365
 
1676
1366
  export function Inference_inferOperator(self_, environment_, expected_, operator_, term_) {
1677
1367
  const e_ = (((_1) => {
1678
- {
1679
1368
  if(_1.ECall) {
1680
1369
  const e_ = _1;
1681
1370
  return e_
1682
- return
1683
- }
1684
1371
  }
1685
1372
  {
1686
1373
  return ff_compiler_Inference.fail_(term_.at_, "Call expected")
1687
- return
1688
1374
  }
1689
1375
  }))(term_);
1690
1376
  const target_ = ff_compiler_Syntax.StaticCall(operator_, false, false);
1691
1377
  {
1692
1378
  const _1 = e_.arguments_;
1693
- {
1694
- if(_1.length > 0) {
1695
- const a1_ = _1[0];
1696
1379
  if(_1.length === 1) {
1697
- const _guard1 = (operator_ === "!");
1698
- if(_guard1) {
1380
+ const a1_ = _1[0];
1381
+ if((operator_ === "!")) {
1699
1382
  const t_ = ff_compiler_Syntax.TConstructor(e_.at_, ff_compiler_Inference.core_("Bool"), []);
1700
1383
  const e1_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, a1_.value_);
1701
1384
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t_);
@@ -1712,52 +1395,33 @@ return
1712
1395
  return
1713
1396
  }
1714
1397
  }
1715
- }
1716
- }
1717
- {
1718
- if(_1.length > 0) {
1719
- const a1_ = _1[0];
1720
1398
  if(_1.length === 1) {
1721
- const _guard1 = (operator_ === "-");
1722
- if(_guard1) {
1399
+ const a1_ = _1[0];
1400
+ if((operator_ === "-")) {
1723
1401
  const t1_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
1724
1402
  const e1_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t1_, a1_.value_);
1725
1403
  do {
1726
1404
  const _1 = ff_compiler_Unification.Unification_substitute(self_.unification_, t1_);
1727
- {
1728
- if(_1.TConstructor) {
1405
+ if(_1.TConstructor && _1.generics_.length === 0) {
1729
1406
  const name_ = _1.name_;
1730
- if(_1.generics_.length === 0) {
1731
- const _guard1 = (name_ === ff_compiler_Inference.core_("Float"));
1732
- if(_guard1) {
1407
+ if((name_ === ff_compiler_Inference.core_("Float"))) {
1733
1408
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t1_)
1734
1409
  break
1735
1410
  }
1736
1411
  }
1737
- }
1738
- }
1739
- {
1740
- if(_1.TConstructor) {
1412
+ if(_1.TConstructor && _1.generics_.length === 0) {
1741
1413
  const name_ = _1.name_;
1742
- if(_1.generics_.length === 0) {
1743
- const _guard1 = (name_ === ff_compiler_Inference.core_("Int"));
1744
- if(_guard1) {
1414
+ if((name_ === ff_compiler_Inference.core_("Int"))) {
1745
1415
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t1_)
1746
1416
  break
1747
1417
  }
1748
1418
  }
1749
- }
1750
- }
1751
- {
1752
- const _guard1 = ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_);
1753
- if(_guard1) {
1419
+ if(ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) {
1754
1420
 
1755
1421
  break
1756
1422
  }
1757
- }
1758
1423
  {
1759
1424
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(e_.at_, "Operators on unknown types not currently supported"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1760
- break
1761
1425
  }
1762
1426
  } while(false);
1763
1427
  {
@@ -1773,16 +1437,10 @@ return
1773
1437
  return
1774
1438
  }
1775
1439
  }
1776
- }
1777
- }
1778
- {
1779
- if(_1.length > 0) {
1440
+ if(_1.length === 2) {
1780
1441
  const a1_ = _1[0];
1781
- if(_1.length > 1) {
1782
1442
  const a2_ = _1[1];
1783
- if(_1.length === 2) {
1784
- const _guard1 = ((operator_ === "||") || (operator_ === "&&"));
1785
- if(_guard1) {
1443
+ if(((operator_ === "||") || (operator_ === "&&"))) {
1786
1444
  const t_ = ff_compiler_Syntax.TConstructor(e_.at_, ff_compiler_Inference.core_("Bool"), []);
1787
1445
  const e1_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, a1_.value_);
1788
1446
  const e2_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, a2_.value_);
@@ -1802,17 +1460,10 @@ return
1802
1460
  return
1803
1461
  }
1804
1462
  }
1805
- }
1806
- }
1807
- }
1808
- {
1809
- if(_1.length > 0) {
1463
+ if(_1.length === 2) {
1810
1464
  const a1_ = _1[0];
1811
- if(_1.length > 1) {
1812
1465
  const a2_ = _1[1];
1813
- if(_1.length === 2) {
1814
- const _guard1 = ((operator_ === "===") || (operator_ === "!=="));
1815
- if(_guard1) {
1466
+ if(((operator_ === "===") || (operator_ === "!=="))) {
1816
1467
  const t1_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
1817
1468
  const e1_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t1_, a1_.value_);
1818
1469
  const e2_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t1_, a2_.value_);
@@ -1832,17 +1483,10 @@ return
1832
1483
  return
1833
1484
  }
1834
1485
  }
1835
- }
1836
- }
1837
- }
1838
- {
1839
- if(_1.length > 0) {
1486
+ if(_1.length === 2) {
1840
1487
  const a1_ = _1[0];
1841
- if(_1.length > 1) {
1842
1488
  const a2_ = _1[1];
1843
- if(_1.length === 2) {
1844
- const _guard1 = ((((((operator_ === "+") || (operator_ === "-")) || (operator_ === "*")) || (operator_ === "/")) || (operator_ === "%")) || (operator_ === "^"));
1845
- if(_guard1) {
1489
+ if(((((((operator_ === "+") || (operator_ === "-")) || (operator_ === "*")) || (operator_ === "/")) || (operator_ === "%")) || (operator_ === "^"))) {
1846
1490
  const t1_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
1847
1491
  const t2_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
1848
1492
  const e1_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t1_, a1_.value_);
@@ -1850,149 +1494,73 @@ const e2_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t2_,
1850
1494
  const magic_ = ((t_) => {
1851
1495
  {
1852
1496
  const _1 = ff_compiler_Unification.Unification_substitute(self_.unification_, t_);
1853
- {
1854
- if(_1.TConstructor) {
1497
+ if(_1.TConstructor && _1.generics_.length === 0) {
1855
1498
  const name_ = _1.name_;
1856
- if(_1.generics_.length === 0) {
1857
- const _guard1 = (name_ === ff_compiler_Inference.core_("Float"));
1858
- if(_guard1) {
1499
+ if((name_ === ff_compiler_Inference.core_("Float"))) {
1859
1500
  return ff_core_Option.Some("Float")
1860
- return
1861
1501
  }
1862
1502
  }
1863
- }
1864
- }
1865
- {
1866
- if(_1.TConstructor) {
1503
+ if(_1.TConstructor && _1.generics_.length === 0) {
1867
1504
  const name_ = _1.name_;
1868
- if(_1.generics_.length === 0) {
1869
- const _guard1 = (name_ === ff_compiler_Inference.core_("Int"));
1870
- if(_guard1) {
1505
+ if((name_ === ff_compiler_Inference.core_("Int"))) {
1871
1506
  return ff_core_Option.Some("Int")
1872
- return
1873
- }
1874
1507
  }
1875
1508
  }
1876
- }
1877
- {
1878
- if(_1.TConstructor) {
1509
+ if(_1.TConstructor && _1.generics_.length === 0) {
1879
1510
  const name_ = _1.name_;
1880
- if(_1.generics_.length === 0) {
1881
- const _guard1 = ((operator_ === "+") && (name_ === ff_compiler_Inference.core_("String")));
1882
- if(_guard1) {
1511
+ if(((operator_ === "+") && (name_ === ff_compiler_Inference.core_("String")))) {
1883
1512
  return ff_core_Option.Some("String")
1884
- return
1885
- }
1886
- }
1887
1513
  }
1888
1514
  }
1889
1515
  {
1890
1516
  return ff_core_Option.None()
1891
- return
1892
1517
  }
1893
1518
  }
1894
1519
  });
1895
1520
  const chooseType_ = ((_1, _2) => {
1896
- {
1897
- if(_1.Some) {
1898
- if(_1.value_ === "String") {
1899
- if(_2.Some) {
1521
+ if(_1.Some && _1.value_ === "String" && _2.Some) {
1900
1522
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t1_)
1901
1523
  return
1902
1524
  }
1903
- }
1904
- }
1905
- }
1906
- {
1907
- if(_1.Some) {
1908
- if(_2.Some) {
1909
- if(_2.value_ === "String") {
1525
+ if(_1.Some && _2.Some && _2.value_ === "String") {
1910
1526
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t2_)
1911
1527
  return
1912
1528
  }
1913
- }
1914
- }
1915
- }
1916
- {
1917
- if(_1.Some) {
1918
- if(_1.value_ === "Float") {
1919
- if(_2.Some) {
1529
+ if(_1.Some && _1.value_ === "Float" && _2.Some) {
1920
1530
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t1_)
1921
1531
  return
1922
1532
  }
1923
- }
1924
- }
1925
- }
1926
- {
1927
- if(_1.Some) {
1928
- if(_2.Some) {
1929
- if(_2.value_ === "Float") {
1533
+ if(_1.Some && _2.Some && _2.value_ === "Float") {
1930
1534
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t2_)
1931
1535
  return
1932
1536
  }
1933
- }
1934
- }
1935
- }
1936
- {
1937
- if(_1.Some) {
1938
- if(_1.value_ === "Int") {
1939
- if(_2.Some) {
1537
+ if(_1.Some && _1.value_ === "Int" && _2.Some) {
1940
1538
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t1_)
1941
1539
  return
1942
1540
  }
1943
- }
1944
- }
1945
- }
1946
- {
1947
- if(_1.Some) {
1948
- if(_2.Some) {
1949
- if(_2.value_ === "Int") {
1541
+ if(_1.Some && _2.Some && _2.value_ === "Int") {
1950
1542
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t2_)
1951
1543
  return
1952
1544
  }
1953
- }
1954
- }
1955
- }
1956
- {
1957
- if(_1.Some) {
1958
- if(_2.None) {
1545
+ if(_1.Some && _2.None) {
1959
1546
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, t1_, t2_);
1960
1547
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t1_)
1961
1548
  return
1962
1549
  }
1963
- }
1964
- }
1965
- {
1966
- if(_1.None) {
1967
- if(_2.Some) {
1550
+ if(_1.None && _2.Some) {
1968
1551
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, t2_, t1_);
1969
1552
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t2_)
1970
1553
  return
1971
1554
  }
1972
- }
1973
- }
1974
- {
1975
- const _guard1 = ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_);
1976
- if(_guard1) {
1555
+ if(ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) {
1977
1556
 
1978
1557
  return
1979
1558
  }
1980
- }
1981
- {
1982
- if(_1.Some) {
1983
- if(_2.Some) {
1559
+ if(_1.Some && _2.Some) {
1984
1560
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(e_.at_, "Operators on these types not currently supported"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1985
- return
1986
- }
1987
1561
  }
1988
- }
1989
- {
1990
- if(_1.None) {
1991
- if(_2.None) {
1562
+ if(_1.None && _2.None) {
1992
1563
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(e_.at_, "Operators on unknown types not currently supported"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1993
- return
1994
- }
1995
- }
1996
1564
  }
1997
1565
  });
1998
1566
  chooseType_(magic_(t1_), magic_(t2_));
@@ -2011,19 +1579,11 @@ return
2011
1579
  return
2012
1580
  }
2013
1581
  }
2014
- }
2015
- }
2016
- }
2017
- {
2018
- const _guard1 = ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_);
2019
- if(_guard1) {
1582
+ if(ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) {
2020
1583
  return term_
2021
- return
2022
- }
2023
1584
  }
2024
1585
  {
2025
1586
  return ff_compiler_Inference.fail_(e_.at_, ("Unknown operator: " + operator_))
2026
- return
2027
1587
  }
2028
1588
  }
2029
1589
  }
@@ -2103,7 +1663,6 @@ ff_core_Array.Array_delete(remainingArguments_, _w1, 1)
2103
1663
  }));
2104
1664
  const e2_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, e_);
2105
1665
  return ff_compiler_Syntax.Argument(at_, ff_core_Option.Some(p_.name_), e2_)
2106
- return
2107
1666
  }
2108
1667
  })), (() => {
2109
1668
  return defaultArgument_()
@@ -2112,21 +1671,17 @@ return defaultArgument_()
2112
1671
  }));
2113
1672
  if((!ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_))) {
2114
1673
  ff_core_Option.Option_each(ff_core_Array.Array_first(remainingArguments_), ((_1) => {
2115
- {
2116
- const callAt_ = _1.at_;
2117
1674
  if(_1.name_.None) {
1675
+ const callAt_ = _1.at_;
2118
1676
  ff_compiler_Inference.fail_(callAt_, "Too many arguments")
2119
1677
  return
2120
1678
  }
2121
- }
2122
- {
2123
- const callAt_ = _1.at_;
2124
1679
  if(_1.name_.Some) {
1680
+ const callAt_ = _1.at_;
2125
1681
  const n_ = _1.name_.value_;
2126
1682
  ff_compiler_Inference.fail_(callAt_, ("Unknown argument: " + n_))
2127
1683
  return
2128
1684
  }
2129
- }
2130
1685
  }));
2131
1686
  return newArguments_
2132
1687
  } else {
@@ -2136,7 +1691,6 @@ const _1 = a_;
2136
1691
  {
2137
1692
  const _c = _1;
2138
1693
  return ff_compiler_Syntax.Argument(_c.at_, _c.name_, ff_compiler_Inference.Inference_inferTerm(self_, environment_, ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, a_.at_), a_.value_))
2139
- return
2140
1694
  }
2141
1695
  }
2142
1696
  }))]
@@ -2199,7 +1753,6 @@ const _1 = p_;
2199
1753
  {
2200
1754
  const _c = _1;
2201
1755
  return ff_compiler_Syntax.Parameter(_c.at_, _c.mutable_, _c.name_, ff_compiler_Unification.Unification_instantiate(self_.unification_, instantiationMap_, p_.valueType_), _c.default_)
2202
- return
2203
1756
  }
2204
1757
  }
2205
1758
  }));
@@ -2220,14 +1773,12 @@ return ff_compiler_Environment.Scheme(_c.isVariable_, _c.isMutable_, _c.isNewtyp
2220
1773
  if((ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, at_) || ff_compiler_LspHook.LspHook_isDefinedAt(self_.lspHook_, scheme_.signature_.at_))) {
2221
1774
  const symbolHook_ = ff_compiler_LspHook.SymbolHook(symbol_, at_, scheme_.signature_.at_);
2222
1775
  const emittedHook_ = (((_1) => {
2223
- {
2224
1776
  if(_1.InferLookupHook) {
2225
1777
  const h_ = _1;
2226
1778
  h_.symbol_.value_ = symbolHook_;
2227
1779
  h_.instantiated_.value_ = ff_core_Option.Some(instantiated_)
2228
1780
  return
2229
1781
  }
2230
- }
2231
1782
  {
2232
1783
 
2233
1784
  return
@@ -2274,7 +1825,6 @@ const _1 = definition_;
2274
1825
  {
2275
1826
  const _c = _1;
2276
1827
  return ff_compiler_Syntax.DTrait(_c.at_, _c.name_, _c.generics_, _c.constraints_, _c.generatorParameters_, _c.methods_, _c.methodDefaults_, _c.methodGenerators_)
2277
- return
2278
1828
  }
2279
1829
  }
2280
1830
  }
@@ -2322,7 +1872,6 @@ const _1 = p_;
2322
1872
  {
2323
1873
  const _c = _1;
2324
1874
  return ff_compiler_Syntax.Parameter(_c.at_, _c.mutable_, _c.name_, ff_compiler_Unification.Unification_instantiate(self_.unification_, instantiationMap_, p_.valueType_), _c.default_)
2325
- return
2326
1875
  }
2327
1876
  }
2328
1877
  }));
@@ -2363,7 +1912,6 @@ const _1 = definition_;
2363
1912
  {
2364
1913
  const _c = _1;
2365
1914
  return ff_compiler_Syntax.DLet(_c.at_, _c.name_, _c.variableType_, value_)
2366
- return
2367
1915
  }
2368
1916
  }
2369
1917
  }
@@ -2385,7 +1933,6 @@ const _1 = case_;
2385
1933
  {
2386
1934
  const _c = _1;
2387
1935
  return ff_compiler_Syntax.MatchCase(_c.at_, [ff_compiler_Syntax.PVariable(method_.at_, ff_core_Option.None()), ...case_.patterns_], _c.guards_, _c.body_)
2388
- return
2389
1936
  }
2390
1937
  }
2391
1938
  })))
@@ -2405,7 +1952,6 @@ const _1 = definition_;
2405
1952
  {
2406
1953
  const _c = _1;
2407
1954
  return ff_compiler_Syntax.DExtend(_c.at_, _c.name_, _c.generics_, _c.constraints_, _c.type_, functions_)
2408
- return
2409
1955
  }
2410
1956
  }
2411
1957
  }
@@ -2448,35 +1994,25 @@ return
2448
1994
  export async function Inference_inferLambda$(self_, environment_, expected_, lambda_, $task) {
2449
1995
  const unitName_ = ff_compiler_Inference.core_("Unit");
2450
1996
  const returnsUnit_ = (((_1) => {
2451
- {
2452
1997
  if(_1.TConstructor) {
2453
1998
  const name_ = _1.name_;
2454
1999
  const ts_ = _1.generics_;
2455
- const _guard1 = ff_core_String.String_startsWith(name_, "Function$", 0);
2456
- if(_guard1) {
2000
+ if(ff_core_String.String_startsWith(name_, "Function$", 0)) {
2457
2001
  {
2458
2002
  const _1 = ff_core_List.List_grabLast(ts_);
2459
- {
2460
- if(_1.TConstructor) {
2003
+ if(_1.TConstructor && _1.generics_.length === 0) {
2461
2004
  const n_ = _1.name_;
2462
- if(_1.generics_.length === 0) {
2463
2005
  return (n_ === unitName_)
2464
- return
2465
- }
2466
- }
2467
2006
  }
2468
2007
  {
2469
2008
  return false
2470
- return
2471
2009
  }
2472
2010
  }
2473
2011
  return
2474
2012
  }
2475
2013
  }
2476
- }
2477
2014
  {
2478
2015
  return false
2479
- return
2480
2016
  }
2481
2017
  }))(ff_compiler_Unification.Unification_substitute(self_.unification_, expected_));
2482
2018
  const cases_ = ((!returnsUnit_)
@@ -2487,7 +2023,6 @@ const _1 = c_;
2487
2023
  {
2488
2024
  const _c = _1;
2489
2025
  return ff_compiler_Syntax.MatchCase(_c.at_, _c.patterns_, _c.guards_, ff_compiler_Syntax.ESequential(c_.at_, c_.body_, ff_compiler_Syntax.EVariant(c_.at_, unitName_, [], ff_core_Option.None())))
2490
- return
2491
2026
  }
2492
2027
  }
2493
2028
  })));
@@ -2525,7 +2060,6 @@ const at_ = _2.first_;
2525
2060
  const type_ = _2.second_;
2526
2061
  const noEffect_ = ff_compiler_Syntax.TConstructor(at_, "ff:core/Nothing.Nothing", []);
2527
2062
  return ff_compiler_Environment.Scheme(true, false, false, false, ff_compiler_Syntax.Signature(at_, name_, false, [], [], [], type_, noEffect_))
2528
- return
2529
2063
  }
2530
2064
  }), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
2531
2065
  {
@@ -2533,7 +2067,6 @@ const _1 = environment_;
2533
2067
  {
2534
2068
  const _c = _1;
2535
2069
  return ff_compiler_Environment.Environment(_c.modulePrefix_, ff_core_Map.Map_addAll(environment1_.symbols_, symbols_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), _c.traits_, _c.imports_, _c.effect_, _c.selfVariable_)
2536
- return
2537
2070
  }
2538
2071
  }
2539
2072
  return
@@ -2550,7 +2083,6 @@ const at_ = _2.first_;
2550
2083
  const type_ = _2.second_;
2551
2084
  const noEffect_ = ff_compiler_Syntax.TConstructor(at_, "ff:core/Nothing.Nothing", []);
2552
2085
  return ff_compiler_Environment.Scheme(true, false, false, false, ff_compiler_Syntax.Signature(at_, name_, false, [], [], [], type_, noEffect_))
2553
- return
2554
2086
  }
2555
2087
  }), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
2556
2088
  ff_core_Array.Array_push(guards_, (((_c) => {
@@ -2561,7 +2093,6 @@ const _1 = environment2_;
2561
2093
  {
2562
2094
  const _c = _1;
2563
2095
  return ff_compiler_Environment.Environment(_c.modulePrefix_, ff_core_Map.Map_addAll(environment2_.symbols_, symbols_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), _c.traits_, _c.imports_, _c.effect_, _c.selfVariable_)
2564
- return
2565
2096
  }
2566
2097
  }
2567
2098
  }));
@@ -2570,7 +2101,6 @@ const _1 = case_;
2570
2101
  {
2571
2102
  const _c = _1;
2572
2103
  return ff_compiler_Syntax.MatchCase(_c.at_, _c.patterns_, ff_core_Array.Array_drain(guards_), ff_compiler_Inference.Inference_inferTerm(self_, environment3_, returnType_, case_.body_))
2573
- return
2574
2104
  }
2575
2105
  }
2576
2106
  }
@@ -2578,24 +2108,17 @@ return
2578
2108
  export async function Inference_inferPattern$(self_, environment_, expected_, pattern_, $task) {
2579
2109
  if(ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) {
2580
2110
  if((((_1) => {
2581
- {
2582
2111
  if(_1.PVariantAs) {
2583
2112
  const at_ = _1.at_;
2584
2113
  const variableAt_ = _1.variableAt_;
2585
2114
  return ((ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, at_) || ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, variableAt_)) || ff_compiler_LspHook.LspHook_isDefinedAt(self_.lspHook_, variableAt_))
2586
- return
2587
- }
2588
2115
  }
2589
- {
2590
2116
  if(_1.PAlias) {
2591
2117
  const at_ = _1.at_;
2592
2118
  return (ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, at_) || ff_compiler_LspHook.LspHook_isDefinedAt(self_.lspHook_, at_))
2593
- return
2594
- }
2595
2119
  }
2596
2120
  {
2597
2121
  return ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, pattern_.at_)
2598
- return
2599
2122
  }
2600
2123
  }))(pattern_)) {
2601
2124
  ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferPatternHook(self_.unification_, environment_, expected_, pattern_))
@@ -2607,53 +2130,30 @@ return ff_core_Map.empty_()
2607
2130
  }
2608
2131
  {
2609
2132
  const _1 = pattern_;
2610
- {
2611
2133
  if(_1.PString) {
2612
2134
  return literal_("String")
2613
- return
2614
2135
  }
2615
- }
2616
- {
2617
2136
  if(_1.PInt) {
2618
2137
  return literal_("Int")
2619
- return
2620
- }
2621
2138
  }
2622
- {
2623
2139
  if(_1.PChar) {
2624
2140
  return literal_("Char")
2625
- return
2626
2141
  }
2627
- }
2628
- {
2629
- if(_1.PVariable) {
2142
+ if(_1.PVariable && _1.name_.None) {
2630
2143
  const at_ = _1.at_;
2631
- if(_1.name_.None) {
2632
2144
  return ff_core_Map.empty_()
2633
- return
2634
2145
  }
2635
- }
2636
- }
2637
- {
2638
- if(_1.PVariable) {
2146
+ if(_1.PVariable && _1.name_.Some) {
2639
2147
  const at_ = _1.at_;
2640
- if(_1.name_.Some) {
2641
2148
  const name_ = _1.name_.value_;
2642
2149
  return ff_core_List.List_toMap([ff_core_Pair.Pair(name_, ff_core_Pair.Pair(at_, expected_))], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
2643
- return
2644
- }
2645
2150
  }
2646
- }
2647
- {
2648
2151
  if(_1.PAlias) {
2649
2152
  const at_ = _1.at_;
2650
2153
  const pattern_ = _1.pattern_;
2651
2154
  const variable_ = _1.variable_;
2652
2155
  return ff_core_Map.Map_add(ff_compiler_Inference.Inference_inferPattern(self_, environment_, expected_, pattern_), variable_, ff_core_Pair.Pair(at_, expected_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
2653
- return
2654
- }
2655
2156
  }
2656
- {
2657
2157
  if(_1.PVariantAs) {
2658
2158
  const at_ = _1.at_;
2659
2159
  const name_ = _1.name_;
@@ -2679,44 +2179,24 @@ return ff_core_Pair.Pair(_w1, ff_core_Pair.Pair(variableAt_, recordType_))
2679
2179
  })), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
2680
2180
  return
2681
2181
  }
2682
- }
2683
- {
2684
- if(_1.PVariant) {
2182
+ if(_1.PVariant && _1.name_ === "List$Empty" && _1.patterns_.length === 0) {
2685
2183
  const at_ = _1.at_;
2686
- if(_1.name_ === "List$Empty") {
2687
- if(_1.patterns_.length === 0) {
2688
2184
  const itemType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, at_);
2689
2185
  const listType_ = ff_compiler_Syntax.TConstructor(at_, ff_compiler_Inference.core_("List"), [itemType_]);
2690
2186
  ff_compiler_Unification.Unification_unify(self_.unification_, at_, expected_, listType_);
2691
2187
  return ff_core_List.List_toMap([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
2692
- return
2693
- }
2694
2188
  }
2695
- }
2696
- }
2697
- {
2698
- if(_1.PVariant) {
2189
+ if(_1.PVariant && _1.name_ === "List$Link" && _1.patterns_.length === 2) {
2699
2190
  const at_ = _1.at_;
2700
- if(_1.name_ === "List$Link") {
2701
- if(_1.patterns_.length > 0) {
2702
2191
  const head_ = _1.patterns_[0];
2703
- if(_1.patterns_.length > 1) {
2704
2192
  const tail_ = _1.patterns_[1];
2705
- if(_1.patterns_.length === 2) {
2706
2193
  const itemType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, at_);
2707
2194
  const listType_ = ff_compiler_Syntax.TConstructor(at_, ff_compiler_Inference.core_("List"), [itemType_]);
2708
2195
  ff_compiler_Unification.Unification_unify(self_.unification_, at_, expected_, listType_);
2709
2196
  const headVariables_ = ff_compiler_Inference.Inference_inferPattern(self_, environment_, itemType_, head_);
2710
2197
  const tailVariables_ = ff_compiler_Inference.Inference_inferPattern(self_, environment_, listType_, tail_);
2711
2198
  return ff_core_Map.Map_addAll(headVariables_, tailVariables_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
2712
- return
2713
- }
2714
- }
2715
- }
2716
2199
  }
2717
- }
2718
- }
2719
- {
2720
2200
  if(_1.PVariant) {
2721
2201
  const at_ = _1.at_;
2722
2202
  const name_ = _1.name_;
@@ -2733,7 +2213,6 @@ return ff_core_List.List_foldLeft(ff_core_List.List_map(ff_core_List.List_zip(pa
2733
2213
  const pattern_ = _1.first_;
2734
2214
  const parameter_ = _1.second_;
2735
2215
  return ff_compiler_Inference.Inference_inferPattern(self_, environment_, parameter_.valueType_, pattern_)
2736
- return
2737
2216
  }
2738
2217
  })), ff_core_Map.empty_(), ((_w1, _w2) => {
2739
2218
  return ff_core_Map.Map_addAll(_w1, _w2, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
@@ -2742,7 +2221,6 @@ return
2742
2221
  }
2743
2222
  }
2744
2223
  }
2745
- }
2746
2224
 
2747
2225
  export async function Inference_inferTerm$(self_, environment_, expected_, term_, $task) {
2748
2226
  const hookRecordTypeBox_ = (ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, term_.at_)
@@ -2758,31 +2236,18 @@ return term_
2758
2236
  }
2759
2237
  {
2760
2238
  const _1 = term_;
2761
- {
2762
2239
  if(_1.EString) {
2763
2240
  return literal_("String")
2764
- return
2765
- }
2766
2241
  }
2767
- {
2768
2242
  if(_1.EChar) {
2769
2243
  return literal_("Char")
2770
- return
2771
2244
  }
2772
- }
2773
- {
2774
2245
  if(_1.EInt) {
2775
2246
  return literal_("Int")
2776
- return
2777
- }
2778
2247
  }
2779
- {
2780
2248
  if(_1.EFloat) {
2781
2249
  return literal_("Float")
2782
- return
2783
2250
  }
2784
- }
2785
- {
2786
2251
  if(_1.EVariable) {
2787
2252
  const e_ = _1;
2788
2253
  return ff_core_Option.Option_else(ff_core_Option.Option_map(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, e_.name_, [], ff_core_Option.None()), ((instantiated_) => {
@@ -2797,8 +2262,6 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Sy
2797
2262
  }))
2798
2263
  return
2799
2264
  }
2800
- }
2801
- {
2802
2265
  if(_1.EField) {
2803
2266
  const e_ = _1;
2804
2267
  const recordType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
@@ -2810,13 +2273,11 @@ _w1.value_ = ff_core_Option.Some(recordType_)
2810
2273
  const record_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, recordType_, e_.record_);
2811
2274
  {
2812
2275
  const _1 = ff_compiler_Unification.Unification_substitute(self_.unification_, recordType_);
2813
- {
2814
- const t_ = _1;
2815
2276
  if(_1.TConstructor) {
2277
+ const t_ = _1;
2816
2278
  const name_ = _1.name_;
2817
2279
  const typeArguments_ = _1.generics_;
2818
- const _guard1 = ff_core_String.String_startsWith(name_, "Record$", 0);
2819
- if(_guard1) {
2280
+ if(ff_core_String.String_startsWith(name_, "Record$", 0)) {
2820
2281
  if(ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, e_.at_)) {
2821
2282
  const symbolHook_ = ff_compiler_LspHook.SymbolHook(e_.field_, e_.at_, e_.at_);
2822
2283
  const noEffect_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
@@ -2828,14 +2289,13 @@ return (_w1.second_ === e_.field_)
2828
2289
  })), ((_w1) => {
2829
2290
  return _w1.first_
2830
2291
  })), ((index_) => {
2831
- const t1_ = ff_core_List.List_grab(typeArguments_, index_);
2292
+ const t1_ = (typeArguments_[index_] ?? ff_core_List.internalGrab_(typeArguments_, index_));
2832
2293
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t1_);
2833
2294
  {
2834
2295
  const _1 = e_;
2835
2296
  {
2836
2297
  const _c = _1;
2837
2298
  return ff_compiler_Syntax.EField(_c.at_, _c.newtype_, record_, _c.field_)
2838
- return
2839
2299
  }
2840
2300
  }
2841
2301
  })), (() => {
@@ -2848,31 +2308,24 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Sy
2848
2308
  return
2849
2309
  }
2850
2310
  }
2851
- }
2852
- {
2853
- const t_ = _1;
2854
2311
  if(_1.TConstructor) {
2312
+ const t_ = _1;
2855
2313
  const name_ = _1.name_;
2856
2314
  const typeArguments_ = _1.generics_;
2857
2315
  const memberPrefix_ = (name_ + "_");
2858
2316
  const memberName_ = (memberPrefix_ + e_.field_);
2859
2317
  {
2860
2318
  const _1 = ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, memberName_, typeArguments_, ff_core_Option.None());
2861
- {
2862
2319
  if(_1.Some) {
2863
2320
  const instantiated_ = _1.value_;
2864
- const _guard1 = (!instantiated_.scheme_.isVariable_);
2865
- if(_guard1) {
2321
+ if((!instantiated_.scheme_.isVariable_)) {
2866
2322
  const signature_ = (((_c) => {
2867
2323
  return ff_compiler_Syntax.Signature(_c.at_, _c.name_, _c.member_, _c.generics_, _c.constraints_, ff_core_List.List_dropFirst(instantiated_.scheme_.signature_.parameters_, 1), _c.returnType_, _c.effect_)
2868
2324
  }))(instantiated_.scheme_.signature_);
2869
2325
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, recordType_, ff_core_List.List_grab(instantiated_.scheme_.signature_.parameters_, 0).valueType_);
2870
2326
  return ff_compiler_Inference.Inference_inferEtaExpansion(self_, environment_, expected_, e_.at_, signature_, term_)
2871
- return
2872
- }
2873
2327
  }
2874
2328
  }
2875
- {
2876
2329
  if(_1.Some) {
2877
2330
  const instantiated_ = _1.value_;
2878
2331
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, instantiated_.scheme_.signature_.returnType_);
@@ -2881,43 +2334,26 @@ const _1 = e_;
2881
2334
  {
2882
2335
  const _c = _1;
2883
2336
  return ff_compiler_Syntax.EField(_c.at_, instantiated_.scheme_.isNewtype_, record_, _c.field_)
2884
- return
2885
2337
  }
2886
2338
  }
2887
2339
  return
2888
2340
  }
2889
- }
2890
- {
2891
2341
  if(_1.None) {
2892
2342
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(e_.at_, ((("No such field " + e_.field_) + " on type: ") + ff_compiler_Syntax.Type_show(t_, []))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2893
- return
2894
- }
2895
2343
  }
2896
2344
  }
2897
2345
  return
2898
2346
  }
2899
- }
2900
- {
2901
- if(_1.TVariable) {
2902
- const _guard1 = ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_);
2903
- if(_guard1) {
2347
+ if(_1.TVariable && ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) {
2904
2348
  return term_
2905
- return
2906
2349
  }
2907
- }
2908
- }
2909
- {
2910
2350
  if(_1.TVariable) {
2911
2351
  const index_ = _1.index_;
2912
2352
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(e_.at_, ((("No such field " + e_.field_) + " on unknown type: $") + index_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2913
- return
2914
- }
2915
2353
  }
2916
2354
  }
2917
2355
  return
2918
2356
  }
2919
- }
2920
- {
2921
2357
  if(_1.EWildcard) {
2922
2358
  const e_ = _1;
2923
2359
  return ff_core_Option.Option_grab(ff_core_Option.Option_map(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, ("_w" + e_.index_), [], ff_core_Option.None()), ((instantiated_) => {
@@ -2926,8 +2362,6 @@ return term_
2926
2362
  })))
2927
2363
  return
2928
2364
  }
2929
- }
2930
- {
2931
2365
  if(_1.EList) {
2932
2366
  const at_ = _1.at_;
2933
2367
  const t_ = _1.elementType_;
@@ -2946,8 +2380,6 @@ return
2946
2380
  })))
2947
2381
  return
2948
2382
  }
2949
- }
2950
- {
2951
2383
  if(_1.ESequential) {
2952
2384
  const at_ = _1.at_;
2953
2385
  const before_ = _1.before_;
@@ -2958,12 +2390,10 @@ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferSequen
2958
2390
  const newExpected_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, at_);
2959
2391
  {
2960
2392
  const _1 = before_;
2961
- {
2962
- if(_1.EPipe) {
2393
+ if(_1.EPipe && _1.function_.ELambda) {
2963
2394
  const at1_ = _1.at_;
2964
2395
  const value_ = _1.value_;
2965
2396
  const effect1_ = _1.effect_;
2966
- if(_1.function_.ELambda) {
2967
2397
  const at2_ = _1.function_.at_;
2968
2398
  const at3_ = _1.function_.lambda_.at_;
2969
2399
  const effect3_ = _1.function_.lambda_.effect_;
@@ -2975,42 +2405,30 @@ const _1 = case_;
2975
2405
  {
2976
2406
  const _c = _1;
2977
2407
  return ff_compiler_Syntax.MatchCase(_c.at_, _c.patterns_, _c.guards_, ff_compiler_Syntax.ESequential(case_.at_, case_.body_, e_))
2978
- return
2979
2408
  }
2980
2409
  }
2981
2410
  }));
2982
2411
  const newPipe_ = ff_compiler_Syntax.EPipe(at1_, value_, effect1_, ff_compiler_Syntax.ELambda(at2_, ff_compiler_Syntax.Lambda(at3_, effect3_, newCases_)));
2983
2412
  {
2984
2413
  const _1 = after_;
2985
- {
2986
- if(_1.EVariant) {
2414
+ if(_1.EVariant && _1.name_ === "ff:core/Unit.Unit") {
2987
2415
  const at_ = _1.at_;
2988
- if(_1.name_ === "ff:core/Unit.Unit") {
2989
2416
  const unitType_ = ff_compiler_Syntax.TConstructor(at_, ff_compiler_Inference.core_("Unit"), []);
2990
2417
  ff_compiler_Unification.Unification_unify(self_.unification_, at_, expected_, unitType_);
2991
2418
  return ff_compiler_Inference.Inference_inferTerm(self_, environment_, newExpected_, newPipe_)
2992
- return
2993
- }
2994
- }
2995
2419
  }
2996
2420
  {
2997
2421
  return ff_compiler_Syntax.ESequential(at_, ff_compiler_Inference.Inference_inferTerm(self_, environment_, newExpected_, newPipe_), ff_compiler_Inference.Inference_inferTerm(self_, environment_, expected_, after_))
2998
- return
2999
2422
  }
3000
2423
  }
3001
2424
  return
3002
2425
  }
3003
- }
3004
- }
3005
2426
  {
3006
2427
  return ff_compiler_Syntax.ESequential(at_, ff_compiler_Inference.Inference_inferTerm(self_, environment_, newExpected_, before_), ff_compiler_Inference.Inference_inferTerm(self_, environment_, expected_, after_))
3007
- return
3008
2428
  }
3009
2429
  }
3010
2430
  return
3011
2431
  }
3012
- }
3013
- {
3014
2432
  if(_1.ELet) {
3015
2433
  const e_ = _1;
3016
2434
  const noEffect_ = ff_compiler_Syntax.TConstructor(e_.at_, "ff:core/Nothing.Nothing", []);
@@ -3023,64 +2441,29 @@ const _1 = e_;
3023
2441
  {
3024
2442
  const _c = _1;
3025
2443
  return ff_compiler_Syntax.ELet(_c.at_, _c.mutable_, _c.name_, _c.valueType_, ff_compiler_Inference.Inference_inferTerm(self_, environment_, e_.valueType_, e_.value_), ff_compiler_Inference.Inference_inferTerm(self_, environment2_, expected_, e_.body_))
3026
- return
3027
2444
  }
3028
2445
  }
3029
2446
  return
3030
2447
  }
3031
- }
3032
- {
3033
2448
  if(_1.ELambda) {
3034
2449
  const at_ = _1.at_;
3035
2450
  const l_ = _1.lambda_;
3036
2451
  do {
3037
2452
  const _1 = l_.cases_;
3038
- {
3039
- if(_1.length > 0) {
3040
- if(_1[0].patterns_.length === 0) {
3041
- if(_1[0].guards_.length === 0) {
3042
- if(_1[0].body_.EVariable) {
2453
+ if(_1.length === 1 && _1[0].patterns_.length === 0 && _1[0].guards_.length === 0 && _1[0].body_.EVariable && _1[0].body_.name_ === "") {
3043
2454
  const insideAt_ = _1[0].body_.at_;
3044
- if(_1[0].body_.name_ === "") {
3045
- if(_1.length === 1) {
3046
- const _guard1 = ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, insideAt_);
3047
- if(_guard1) {
2455
+ if(ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, insideAt_)) {
3048
2456
  ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferLambdaStartHook(self_.unification_, environment_, expected_))
3049
2457
  break
3050
2458
  }
3051
2459
  }
3052
- }
3053
- }
3054
- }
3055
- }
3056
- }
3057
- }
3058
- {
3059
- if(_1.length > 0) {
3060
- if(_1[0].patterns_.length === 0) {
3061
- if(_1[0].guards_.length === 0) {
3062
- if(_1[0].body_.ESequential) {
3063
- if(_1[0].body_.before_.EVariable) {
2460
+ if(_1.length === 1 && _1[0].patterns_.length === 0 && _1[0].guards_.length === 0 && _1[0].body_.ESequential && _1[0].body_.before_.EVariable && _1[0].body_.before_.name_ === "" && _1[0].body_.after_.EVariant && _1[0].body_.after_.name_ === "ff:core/Unit.Unit") {
3064
2461
  const insideAt_ = _1[0].body_.before_.at_;
3065
- if(_1[0].body_.before_.name_ === "") {
3066
- if(_1[0].body_.after_.EVariant) {
3067
- if(_1[0].body_.after_.name_ === "ff:core/Unit.Unit") {
3068
- if(_1.length === 1) {
3069
- const _guard1 = ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, insideAt_);
3070
- if(_guard1) {
2462
+ if(ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, insideAt_)) {
3071
2463
  ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferLambdaStartHook(self_.unification_, environment_, expected_))
3072
2464
  break
3073
2465
  }
3074
2466
  }
3075
- }
3076
- }
3077
- }
3078
- }
3079
- }
3080
- }
3081
- }
3082
- }
3083
- }
3084
2467
  {
3085
2468
 
3086
2469
  break
@@ -3088,10 +2471,7 @@ break
3088
2471
  } while(false);
3089
2472
  const lambda_ = ff_compiler_Inference.Inference_inferLambda(self_, environment_, expected_, l_);
3090
2473
  return ff_compiler_Syntax.ELambda(at_, lambda_)
3091
- return
3092
- }
3093
2474
  }
3094
- {
3095
2475
  if(_1.EVariant) {
3096
2476
  const e_ = _1;
3097
2477
  const instantiated_ = ff_core_Option.Option_else(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, e_.name_, e_.typeArguments_, e_.arguments_), (() => {
@@ -3113,8 +2493,6 @@ return
3113
2493
  }
3114
2494
  return
3115
2495
  }
3116
- }
3117
- {
3118
2496
  if(_1.EVariantIs) {
3119
2497
  const e_ = _1;
3120
2498
  const instantiated_ = ff_core_Option.Option_else(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, e_.name_, e_.typeArguments_, ff_core_Option.None()), (() => {
@@ -3142,8 +2520,6 @@ return
3142
2520
  }
3143
2521
  return
3144
2522
  }
3145
- }
3146
- {
3147
2523
  if(_1.ECopy) {
3148
2524
  const e_ = _1;
3149
2525
  const scheme_ = ff_core_Option.Option_else(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, e_.name_, [], ff_core_Option.None()), (() => {
@@ -3170,7 +2546,6 @@ const _1 = f_;
3170
2546
  {
3171
2547
  const _c = _1;
3172
2548
  return ff_compiler_Syntax.Argument(_c.at_, ff_core_Option.Some(f_.name_), _c.value_)
3173
- return
3174
2549
  }
3175
2550
  }
3176
2551
  }));
@@ -3193,7 +2568,6 @@ const at_ = _1.at_;
3193
2568
  const name_ = _1.name_;
3194
2569
  const value_ = _1.value_;
3195
2570
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ("Unknown parameter: " + name_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
3196
- return
3197
2571
  }
3198
2572
  }));
3199
2573
  const arguments_ = ff_core_List.List_map(parameterNames_, ((name_) => {
@@ -3204,7 +2578,6 @@ return (_w1.name_ === name_)
3204
2578
  const at_ = _1.at_;
3205
2579
  const value_ = _1.value_;
3206
2580
  return ff_compiler_Syntax.Argument(at_, ff_core_Option.Some(name_), value_)
3207
- return
3208
2581
  }
3209
2582
  })), (() => {
3210
2583
  const at_ = (((_c) => {
@@ -3217,10 +2590,7 @@ const body_ = ff_compiler_Syntax.EVariant(e_.at_, e_.name_, [], ff_core_Option.S
3217
2590
  const effect_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
3218
2591
  const e1_ = ff_compiler_Syntax.EPipe(e_.at_, e_.record_, effect_, ff_compiler_Syntax.ELambda(e_.at_, ff_compiler_Syntax.Lambda(e_.at_, effect_, [ff_compiler_Syntax.MatchCase(e_.at_, [ff_compiler_Syntax.PVariable(e_.at_, ff_core_Option.Some("_c"))], [], body_)])));
3219
2592
  return ff_compiler_Inference.Inference_inferTerm(self_, environment_, expected_, e1_)
3220
- return
3221
- }
3222
2593
  }
3223
- {
3224
2594
  if(_1.EPipe) {
3225
2595
  const e_ = _1;
3226
2596
  const valueType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
@@ -3233,47 +2603,33 @@ const _1 = e_;
3233
2603
  {
3234
2604
  const _c = _1;
3235
2605
  return ff_compiler_Syntax.EPipe(_c.at_, value_, _c.effect_, function_)
3236
- return
3237
2606
  }
3238
2607
  }
3239
2608
  return
3240
2609
  }
3241
- }
3242
- {
3243
2610
  if(_1.ECall) {
3244
2611
  const e_ = _1;
3245
2612
  if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (((_1) => {
3246
- {
3247
2613
  if(_1.StaticCall) {
3248
2614
  return true
3249
- return
3250
- }
3251
2615
  }
3252
2616
  {
3253
2617
  return false
3254
- return
3255
2618
  }
3256
2619
  }))(e_.target_))) {
3257
2620
  return term_
3258
2621
  } else {
3259
2622
  const call_ = (((_1) => {
3260
- {
3261
2623
  if(_1.DynamicCall) {
3262
2624
  const call_ = _1;
3263
2625
  return call_
3264
- return
3265
- }
3266
2626
  }
3267
- {
3268
2627
  if(_1.StaticCall) {
3269
2628
  return ff_compiler_Inference.fail_(e_.at_, "Internal error: Static calls not expected in the Inference phase")
3270
- return
3271
- }
3272
2629
  }
3273
2630
  }))(e_.target_);
3274
2631
  {
3275
2632
  const _1 = call_.function_;
3276
- {
3277
2633
  if(_1.EVariable) {
3278
2634
  const variableAt_ = _1.at_;
3279
2635
  const x_ = _1.name_;
@@ -3284,7 +2640,6 @@ return ff_compiler_Inference.Inference_inferOperator(self_, environment_, expect
3284
2640
  } else {
3285
2641
  {
3286
2642
  const _1 = ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, x_, e_.typeArguments_, ff_core_Option.Some(e_.arguments_));
3287
- {
3288
2643
  if(_1.Some) {
3289
2644
  const instantiated_ = _1.value_;
3290
2645
  if(instantiated_.scheme_.isVariable_) {
@@ -3295,19 +2650,13 @@ return ff_compiler_Inference.Inference_inferFunctionCall(self_, environment_, ex
3295
2650
  }
3296
2651
  return
3297
2652
  }
3298
- }
3299
- {
3300
2653
  if(_1.None) {
3301
2654
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(variableAt_, ("No such function: " + x_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
3302
- return
3303
- }
3304
2655
  }
3305
2656
  }
3306
2657
  }
3307
2658
  return
3308
2659
  }
3309
- }
3310
- {
3311
2660
  if(_1.EField) {
3312
2661
  const f_ = _1;
3313
2662
  const recordType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, f_.at_);
@@ -3326,71 +2675,46 @@ return ff_compiler_Syntax.EField(_c.at_, _c.newtype_, record_, _c.field_)
3326
2675
  }))(e_);
3327
2676
  {
3328
2677
  const _1 = ff_compiler_Unification.Unification_substitute(self_.unification_, recordType_);
3329
- {
3330
- const t_ = _1;
3331
2678
  if(_1.TConstructor) {
2679
+ const t_ = _1;
3332
2680
  const name_ = _1.name_;
3333
2681
  const methodName_ = ((name_ + "_") + f_.field_);
3334
2682
  const arguments_ = [ff_compiler_Syntax.Argument(f_.record_.at_, ff_core_Option.None(), f_.record_), ...e_.arguments_];
3335
2683
  {
3336
2684
  const _1 = ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, f_.at_, methodName_, [], ff_core_Option.Some(arguments_));
3337
- {
3338
2685
  if(_1.Some) {
3339
2686
  const instantiated_ = _1.value_;
3340
- const _guard1 = (!instantiated_.scheme_.isVariable_);
3341
- if(_guard1) {
2687
+ if((!instantiated_.scheme_.isVariable_)) {
3342
2688
  return ff_compiler_Inference.Inference_inferMethodCall(self_, environment_, expected_, instantiated_.scheme_.signature_, instantiated_.typeArguments_, e2_, record_, recordType_, methodName_)
3343
- return
3344
- }
3345
2689
  }
3346
2690
  }
3347
- {
3348
2691
  if(_1.Some) {
3349
2692
  const instantiated_ = _1.value_;
3350
2693
  return ff_compiler_Inference.Inference_inferLambdaCall(self_, environment_, expected_, e2_)
3351
- return
3352
- }
3353
2694
  }
3354
- {
3355
2695
  if(_1.None) {
3356
2696
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(f_.at_, ((("No such field " + f_.field_) + " on type: ") + ff_compiler_Syntax.Type_show(t_, []))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
3357
- return
3358
- }
3359
2697
  }
3360
2698
  }
3361
2699
  return
3362
2700
  }
3363
- }
3364
- {
3365
- if(_1.TVariable) {
3366
- const _guard1 = ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_);
3367
- if(_guard1) {
2701
+ if(_1.TVariable && ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) {
3368
2702
  return ff_compiler_Inference.Inference_inferLambdaCall(self_, environment_, expected_, e2_)
3369
- return
3370
2703
  }
3371
- }
3372
- }
3373
- {
3374
2704
  if(_1.TVariable) {
3375
2705
  const index_ = _1.index_;
3376
2706
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(f_.at_, ((("No such field " + f_.field_) + " on unknown type: $") + index_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
3377
- return
3378
- }
3379
2707
  }
3380
2708
  }
3381
2709
  return
3382
2710
  }
3383
- }
3384
2711
  {
3385
2712
  return ff_compiler_Inference.Inference_inferLambdaCall(self_, environment_, expected_, term_)
3386
- return
3387
2713
  }
3388
2714
  }
3389
2715
  }
3390
2716
  return
3391
2717
  }
3392
- }
3393
- {
3394
2718
  if(_1.ERecord) {
3395
2719
  const e_ = _1;
3396
2720
  const fields_ = ff_core_List.List_sortBy(e_.fields_, ((_w1) => {
@@ -3412,7 +2736,6 @@ const _1 = field_;
3412
2736
  {
3413
2737
  const _c = _1;
3414
2738
  return ff_compiler_Syntax.Field(_c.at_, _c.name_, ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, field_.value_))
3415
- return
3416
2739
  }
3417
2740
  }
3418
2741
  return
@@ -3423,13 +2746,10 @@ const _1 = e_;
3423
2746
  {
3424
2747
  const _c = _1;
3425
2748
  return ff_compiler_Syntax.ERecord(_c.at_, newFields_)
3426
- return
3427
2749
  }
3428
2750
  }
3429
2751
  return
3430
2752
  }
3431
- }
3432
- {
3433
2753
  if(_1.EFunctions) {
3434
2754
  const at_ = _1.at_;
3435
2755
  const functions_ = _1.functions_;
@@ -3446,10 +2766,7 @@ return ff_compiler_Inference.Inference_inferFunctionDefinition(self_, environmen
3446
2766
  }));
3447
2767
  const newBody_ = ff_compiler_Inference.Inference_inferTerm(self_, environment2_, expected_, body_);
3448
2768
  return ff_compiler_Syntax.EFunctions(at_, newFunctions_, newBody_)
3449
- return
3450
2769
  }
3451
- }
3452
- {
3453
2770
  if(_1.EAssign) {
3454
2771
  const e_ = _1;
3455
2772
  return ff_core_Option.Option_else(ff_core_Option.Option_map(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, e_.variable_, [], ff_core_Option.None()), ((instantiated_) => {
@@ -3460,7 +2777,6 @@ const _1 = e_;
3460
2777
  {
3461
2778
  const _c = _1;
3462
2779
  return ff_compiler_Syntax.EAssign(_c.at_, _c.operator_, _c.variable_, value_)
3463
- return
3464
2780
  }
3465
2781
  }
3466
2782
  } else {
@@ -3471,91 +2787,63 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Sy
3471
2787
  }))
3472
2788
  return
3473
2789
  }
3474
- }
3475
- {
3476
2790
  if(_1.EAssignField) {
3477
2791
  const e_ = _1;
3478
2792
  const recordType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
3479
2793
  const record_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, recordType_, e_.record_);
3480
2794
  {
3481
2795
  const _1 = ff_compiler_Unification.Unification_substitute(self_.unification_, recordType_);
3482
- {
3483
- const t_ = _1;
3484
2796
  if(_1.TConstructor) {
2797
+ const t_ = _1;
3485
2798
  const name_ = _1.name_;
3486
2799
  const typeArguments_ = _1.generics_;
3487
- const _guard1 = ff_core_String.String_startsWith(name_, "Record$", 0);
3488
- if(_guard1) {
2800
+ if(ff_core_String.String_startsWith(name_, "Record$", 0)) {
3489
2801
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(e_.at_, ("Can't assign fields of anonymous records: " + e_.field_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
3490
- return
3491
- }
3492
2802
  }
3493
2803
  }
3494
- {
3495
- const t_ = _1;
3496
2804
  if(_1.TConstructor) {
2805
+ const t_ = _1;
3497
2806
  const name_ = _1.name_;
3498
2807
  const typeArguments_ = _1.generics_;
3499
2808
  const methodName_ = ((name_ + "_") + e_.field_);
3500
2809
  {
3501
2810
  const _1 = ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, methodName_, typeArguments_, ff_core_Option.None());
3502
- {
3503
2811
  if(_1.Some) {
3504
2812
  const instantiated_ = _1.value_;
3505
- const _guard1 = (instantiated_.scheme_.isMutable_ || ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_));
3506
- if(_guard1) {
2813
+ if((instantiated_.scheme_.isMutable_ || ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_))) {
3507
2814
  const value_ = ff_compiler_Inference.Inference_inferAssignment(self_, environment_, expected_, e_.at_, e_.operator_, e_.value_, instantiated_.scheme_.signature_);
3508
2815
  {
3509
2816
  const _1 = e_;
3510
2817
  {
3511
2818
  const _c = _1;
3512
2819
  return ff_compiler_Syntax.EAssignField(_c.at_, _c.operator_, record_, _c.field_, value_)
3513
- return
3514
2820
  }
3515
2821
  }
3516
2822
  return
3517
2823
  }
3518
2824
  }
3519
- }
3520
- {
3521
2825
  if(_1.Some) {
3522
2826
  const instantiated_ = _1.value_;
3523
2827
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(e_.at_, ((("Can't assign an immutable field " + e_.field_) + " on type: ") + ff_compiler_Syntax.Type_show(t_, []))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
3524
- return
3525
- }
3526
2828
  }
3527
- {
3528
2829
  if(_1.None) {
3529
2830
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(e_.at_, ((("No such field " + e_.field_) + " on type: ") + ff_compiler_Syntax.Type_show(t_, []))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
3530
- return
3531
- }
3532
2831
  }
3533
2832
  }
3534
2833
  return
3535
2834
  }
3536
- }
3537
- {
3538
- if(_1.TVariable) {
3539
- const _guard1 = ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_);
3540
- if(_guard1) {
2835
+ if(_1.TVariable && ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) {
3541
2836
  return term_
3542
- return
3543
2837
  }
3544
- }
3545
- }
3546
- {
3547
2838
  if(_1.TVariable) {
3548
2839
  const index_ = _1.index_;
3549
2840
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(e_.at_, ((("No such field " + e_.field_) + " on unknown type: $") + index_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
3550
- return
3551
- }
3552
2841
  }
3553
2842
  }
3554
2843
  return
3555
2844
  }
3556
2845
  }
3557
2846
  }
3558
- }
3559
2847
 
3560
2848
  export async function Inference_inferAssignment$(self_, environment_, expected_, at_, operator_, value_, signature_, $task) {
3561
2849
  const t_ = signature_.returnType_;
@@ -3571,31 +2859,21 @@ return newValue_
3571
2859
 
3572
2860
  export async function Inference_inferMethodCall$(self_, environment_, expected_, signature_, instantiation_, term_, record_, recordType_, name_, $task) {
3573
2861
  const e_ = (((_1) => {
3574
- {
3575
2862
  if(_1.ECall) {
3576
2863
  const e_ = _1;
3577
2864
  return e_
3578
- return
3579
- }
3580
2865
  }
3581
2866
  {
3582
2867
  return ff_compiler_Inference.fail_(term_.at_, "Call expected")
3583
- return
3584
2868
  }
3585
2869
  }))(term_);
3586
2870
  const call_ = (((_1) => {
3587
- {
3588
2871
  if(_1.DynamicCall) {
3589
2872
  const call_ = _1;
3590
2873
  return call_
3591
- return
3592
- }
3593
2874
  }
3594
- {
3595
2875
  if(_1.StaticCall) {
3596
2876
  return ff_compiler_Inference.fail_(e_.at_, "Internal error: Static calls not expected in inferMethodCall")
3597
- return
3598
- }
3599
2877
  }
3600
2878
  }))(e_.target_);
3601
2879
  const selfParameter_ = ff_core_List.List_grabFirst(signature_.parameters_);
@@ -3618,31 +2896,21 @@ return
3618
2896
 
3619
2897
  export async function Inference_inferFunctionCall$(self_, environment_, expected_, signature_, instanceCall_, instantiation_, term_, name_, $task) {
3620
2898
  const e_ = (((_1) => {
3621
- {
3622
2899
  if(_1.ECall) {
3623
2900
  const e_ = _1;
3624
2901
  return e_
3625
- return
3626
- }
3627
2902
  }
3628
2903
  {
3629
2904
  return ff_compiler_Inference.fail_(term_.at_, "Call expected")
3630
- return
3631
2905
  }
3632
2906
  }))(term_);
3633
2907
  const call_ = (((_1) => {
3634
- {
3635
2908
  if(_1.DynamicCall) {
3636
2909
  const call_ = _1;
3637
2910
  return call_
3638
- return
3639
- }
3640
2911
  }
3641
- {
3642
2912
  if(_1.StaticCall) {
3643
2913
  return ff_compiler_Inference.fail_(e_.at_, "Internal error: Static calls not expected in inferFunctionCall")
3644
- return
3645
- }
3646
2914
  }
3647
2915
  }))(e_.target_);
3648
2916
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, signature_.returnType_);
@@ -3662,40 +2930,26 @@ return
3662
2930
 
3663
2931
  export async function Inference_inferLambdaCall$(self_, environment_, expected_, term_, $task) {
3664
2932
  const e_ = (((_1) => {
3665
- {
3666
2933
  if(_1.ECall) {
3667
2934
  const e_ = _1;
3668
2935
  return e_
3669
- return
3670
- }
3671
2936
  }
3672
2937
  {
3673
2938
  return ff_compiler_Inference.fail_(term_.at_, "Call expected")
3674
- return
3675
2939
  }
3676
2940
  }))(term_);
3677
2941
  const call_ = (((_1) => {
3678
- {
3679
2942
  if(_1.DynamicCall) {
3680
2943
  const call_ = _1;
3681
- const _guard1 = (!call_.tailCall_);
3682
- if(_guard1) {
2944
+ if((!call_.tailCall_)) {
3683
2945
  return call_
3684
- return
3685
- }
3686
2946
  }
3687
2947
  }
3688
- {
3689
2948
  if(_1.DynamicCall) {
3690
2949
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(e_.at_, "Tailcalls not supported on lambda functions"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
3691
- return
3692
- }
3693
2950
  }
3694
- {
3695
2951
  if(_1.StaticCall) {
3696
2952
  return ff_compiler_Inference.fail_(e_.at_, "Internal error: Static calls not expected in inferLambdaCall")
3697
- return
3698
- }
3699
2953
  }
3700
2954
  }))(e_.target_);
3701
2955
  const effect_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, term_.at_);
@@ -3716,7 +2970,6 @@ const _1 = argument_;
3716
2970
  {
3717
2971
  const _c = _1;
3718
2972
  return ff_compiler_Syntax.Argument(_c.at_, _c.name_, ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, argument_.value_))
3719
- return
3720
2973
  }
3721
2974
  }
3722
2975
  return
@@ -3740,27 +2993,20 @@ return
3740
2993
 
3741
2994
  export async function Inference_inferOperator$(self_, environment_, expected_, operator_, term_, $task) {
3742
2995
  const e_ = (((_1) => {
3743
- {
3744
2996
  if(_1.ECall) {
3745
2997
  const e_ = _1;
3746
2998
  return e_
3747
- return
3748
- }
3749
2999
  }
3750
3000
  {
3751
3001
  return ff_compiler_Inference.fail_(term_.at_, "Call expected")
3752
- return
3753
3002
  }
3754
3003
  }))(term_);
3755
3004
  const target_ = ff_compiler_Syntax.StaticCall(operator_, false, false);
3756
3005
  {
3757
3006
  const _1 = e_.arguments_;
3758
- {
3759
- if(_1.length > 0) {
3760
- const a1_ = _1[0];
3761
3007
  if(_1.length === 1) {
3762
- const _guard1 = (operator_ === "!");
3763
- if(_guard1) {
3008
+ const a1_ = _1[0];
3009
+ if((operator_ === "!")) {
3764
3010
  const t_ = ff_compiler_Syntax.TConstructor(e_.at_, ff_compiler_Inference.core_("Bool"), []);
3765
3011
  const e1_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, a1_.value_);
3766
3012
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t_);
@@ -3777,52 +3023,33 @@ return
3777
3023
  return
3778
3024
  }
3779
3025
  }
3780
- }
3781
- }
3782
- {
3783
- if(_1.length > 0) {
3784
- const a1_ = _1[0];
3785
3026
  if(_1.length === 1) {
3786
- const _guard1 = (operator_ === "-");
3787
- if(_guard1) {
3027
+ const a1_ = _1[0];
3028
+ if((operator_ === "-")) {
3788
3029
  const t1_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
3789
3030
  const e1_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t1_, a1_.value_);
3790
3031
  do {
3791
3032
  const _1 = ff_compiler_Unification.Unification_substitute(self_.unification_, t1_);
3792
- {
3793
- if(_1.TConstructor) {
3033
+ if(_1.TConstructor && _1.generics_.length === 0) {
3794
3034
  const name_ = _1.name_;
3795
- if(_1.generics_.length === 0) {
3796
- const _guard1 = (name_ === ff_compiler_Inference.core_("Float"));
3797
- if(_guard1) {
3035
+ if((name_ === ff_compiler_Inference.core_("Float"))) {
3798
3036
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t1_)
3799
3037
  break
3800
3038
  }
3801
3039
  }
3802
- }
3803
- }
3804
- {
3805
- if(_1.TConstructor) {
3040
+ if(_1.TConstructor && _1.generics_.length === 0) {
3806
3041
  const name_ = _1.name_;
3807
- if(_1.generics_.length === 0) {
3808
- const _guard1 = (name_ === ff_compiler_Inference.core_("Int"));
3809
- if(_guard1) {
3042
+ if((name_ === ff_compiler_Inference.core_("Int"))) {
3810
3043
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t1_)
3811
3044
  break
3812
3045
  }
3813
3046
  }
3814
- }
3815
- }
3816
- {
3817
- const _guard1 = ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_);
3818
- if(_guard1) {
3047
+ if(ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) {
3819
3048
 
3820
3049
  break
3821
3050
  }
3822
- }
3823
3051
  {
3824
3052
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(e_.at_, "Operators on unknown types not currently supported"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
3825
- break
3826
3053
  }
3827
3054
  } while(false);
3828
3055
  {
@@ -3838,16 +3065,10 @@ return
3838
3065
  return
3839
3066
  }
3840
3067
  }
3841
- }
3842
- }
3843
- {
3844
- if(_1.length > 0) {
3068
+ if(_1.length === 2) {
3845
3069
  const a1_ = _1[0];
3846
- if(_1.length > 1) {
3847
3070
  const a2_ = _1[1];
3848
- if(_1.length === 2) {
3849
- const _guard1 = ((operator_ === "||") || (operator_ === "&&"));
3850
- if(_guard1) {
3071
+ if(((operator_ === "||") || (operator_ === "&&"))) {
3851
3072
  const t_ = ff_compiler_Syntax.TConstructor(e_.at_, ff_compiler_Inference.core_("Bool"), []);
3852
3073
  const e1_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, a1_.value_);
3853
3074
  const e2_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, a2_.value_);
@@ -3867,17 +3088,10 @@ return
3867
3088
  return
3868
3089
  }
3869
3090
  }
3870
- }
3871
- }
3872
- }
3873
- {
3874
- if(_1.length > 0) {
3091
+ if(_1.length === 2) {
3875
3092
  const a1_ = _1[0];
3876
- if(_1.length > 1) {
3877
3093
  const a2_ = _1[1];
3878
- if(_1.length === 2) {
3879
- const _guard1 = ((operator_ === "===") || (operator_ === "!=="));
3880
- if(_guard1) {
3094
+ if(((operator_ === "===") || (operator_ === "!=="))) {
3881
3095
  const t1_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
3882
3096
  const e1_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t1_, a1_.value_);
3883
3097
  const e2_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t1_, a2_.value_);
@@ -3897,17 +3111,10 @@ return
3897
3111
  return
3898
3112
  }
3899
3113
  }
3900
- }
3901
- }
3902
- }
3903
- {
3904
- if(_1.length > 0) {
3114
+ if(_1.length === 2) {
3905
3115
  const a1_ = _1[0];
3906
- if(_1.length > 1) {
3907
3116
  const a2_ = _1[1];
3908
- if(_1.length === 2) {
3909
- const _guard1 = ((((((operator_ === "+") || (operator_ === "-")) || (operator_ === "*")) || (operator_ === "/")) || (operator_ === "%")) || (operator_ === "^"));
3910
- if(_guard1) {
3117
+ if(((((((operator_ === "+") || (operator_ === "-")) || (operator_ === "*")) || (operator_ === "/")) || (operator_ === "%")) || (operator_ === "^"))) {
3911
3118
  const t1_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
3912
3119
  const t2_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
3913
3120
  const e1_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t1_, a1_.value_);
@@ -3915,149 +3122,73 @@ const e2_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t2_,
3915
3122
  const magic_ = ((t_) => {
3916
3123
  {
3917
3124
  const _1 = ff_compiler_Unification.Unification_substitute(self_.unification_, t_);
3918
- {
3919
- if(_1.TConstructor) {
3125
+ if(_1.TConstructor && _1.generics_.length === 0) {
3920
3126
  const name_ = _1.name_;
3921
- if(_1.generics_.length === 0) {
3922
- const _guard1 = (name_ === ff_compiler_Inference.core_("Float"));
3923
- if(_guard1) {
3127
+ if((name_ === ff_compiler_Inference.core_("Float"))) {
3924
3128
  return ff_core_Option.Some("Float")
3925
- return
3926
- }
3927
3129
  }
3928
3130
  }
3929
- }
3930
- {
3931
- if(_1.TConstructor) {
3131
+ if(_1.TConstructor && _1.generics_.length === 0) {
3932
3132
  const name_ = _1.name_;
3933
- if(_1.generics_.length === 0) {
3934
- const _guard1 = (name_ === ff_compiler_Inference.core_("Int"));
3935
- if(_guard1) {
3133
+ if((name_ === ff_compiler_Inference.core_("Int"))) {
3936
3134
  return ff_core_Option.Some("Int")
3937
- return
3938
- }
3939
3135
  }
3940
3136
  }
3941
- }
3942
- {
3943
- if(_1.TConstructor) {
3137
+ if(_1.TConstructor && _1.generics_.length === 0) {
3944
3138
  const name_ = _1.name_;
3945
- if(_1.generics_.length === 0) {
3946
- const _guard1 = ((operator_ === "+") && (name_ === ff_compiler_Inference.core_("String")));
3947
- if(_guard1) {
3139
+ if(((operator_ === "+") && (name_ === ff_compiler_Inference.core_("String")))) {
3948
3140
  return ff_core_Option.Some("String")
3949
- return
3950
- }
3951
- }
3952
3141
  }
3953
3142
  }
3954
3143
  {
3955
3144
  return ff_core_Option.None()
3956
- return
3957
3145
  }
3958
3146
  }
3959
3147
  });
3960
3148
  const chooseType_ = ((_1, _2) => {
3961
- {
3962
- if(_1.Some) {
3963
- if(_1.value_ === "String") {
3964
- if(_2.Some) {
3149
+ if(_1.Some && _1.value_ === "String" && _2.Some) {
3965
3150
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t1_)
3966
3151
  return
3967
3152
  }
3968
- }
3969
- }
3970
- }
3971
- {
3972
- if(_1.Some) {
3973
- if(_2.Some) {
3974
- if(_2.value_ === "String") {
3153
+ if(_1.Some && _2.Some && _2.value_ === "String") {
3975
3154
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t2_)
3976
3155
  return
3977
3156
  }
3978
- }
3979
- }
3980
- }
3981
- {
3982
- if(_1.Some) {
3983
- if(_1.value_ === "Float") {
3984
- if(_2.Some) {
3157
+ if(_1.Some && _1.value_ === "Float" && _2.Some) {
3985
3158
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t1_)
3986
3159
  return
3987
3160
  }
3988
- }
3989
- }
3990
- }
3991
- {
3992
- if(_1.Some) {
3993
- if(_2.Some) {
3994
- if(_2.value_ === "Float") {
3161
+ if(_1.Some && _2.Some && _2.value_ === "Float") {
3995
3162
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t2_)
3996
3163
  return
3997
3164
  }
3998
- }
3999
- }
4000
- }
4001
- {
4002
- if(_1.Some) {
4003
- if(_1.value_ === "Int") {
4004
- if(_2.Some) {
3165
+ if(_1.Some && _1.value_ === "Int" && _2.Some) {
4005
3166
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t1_)
4006
3167
  return
4007
3168
  }
4008
- }
4009
- }
4010
- }
4011
- {
4012
- if(_1.Some) {
4013
- if(_2.Some) {
4014
- if(_2.value_ === "Int") {
3169
+ if(_1.Some && _2.Some && _2.value_ === "Int") {
4015
3170
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t2_)
4016
3171
  return
4017
3172
  }
4018
- }
4019
- }
4020
- }
4021
- {
4022
- if(_1.Some) {
4023
- if(_2.None) {
3173
+ if(_1.Some && _2.None) {
4024
3174
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, t1_, t2_);
4025
3175
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t1_)
4026
3176
  return
4027
3177
  }
4028
- }
4029
- }
4030
- {
4031
- if(_1.None) {
4032
- if(_2.Some) {
3178
+ if(_1.None && _2.Some) {
4033
3179
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, t2_, t1_);
4034
3180
  ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t2_)
4035
3181
  return
4036
3182
  }
4037
- }
4038
- }
4039
- {
4040
- const _guard1 = ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_);
4041
- if(_guard1) {
3183
+ if(ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) {
4042
3184
 
4043
3185
  return
4044
3186
  }
4045
- }
4046
- {
4047
- if(_1.Some) {
4048
- if(_2.Some) {
3187
+ if(_1.Some && _2.Some) {
4049
3188
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(e_.at_, "Operators on these types not currently supported"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
4050
- return
4051
- }
4052
3189
  }
4053
- }
4054
- {
4055
- if(_1.None) {
4056
- if(_2.None) {
3190
+ if(_1.None && _2.None) {
4057
3191
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(e_.at_, "Operators on unknown types not currently supported"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
4058
- return
4059
- }
4060
- }
4061
3192
  }
4062
3193
  });
4063
3194
  chooseType_(magic_(t1_), magic_(t2_));
@@ -4076,19 +3207,11 @@ return
4076
3207
  return
4077
3208
  }
4078
3209
  }
4079
- }
4080
- }
4081
- }
4082
- {
4083
- const _guard1 = ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_);
4084
- if(_guard1) {
3210
+ if(ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) {
4085
3211
  return term_
4086
- return
4087
- }
4088
3212
  }
4089
3213
  {
4090
3214
  return ff_compiler_Inference.fail_(e_.at_, ("Unknown operator: " + operator_))
4091
- return
4092
3215
  }
4093
3216
  }
4094
3217
  }
@@ -4168,7 +3291,6 @@ ff_core_Array.Array_delete(remainingArguments_, _w1, 1)
4168
3291
  }));
4169
3292
  const e2_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, e_);
4170
3293
  return ff_compiler_Syntax.Argument(at_, ff_core_Option.Some(p_.name_), e2_)
4171
- return
4172
3294
  }
4173
3295
  })), (() => {
4174
3296
  return defaultArgument_()
@@ -4177,21 +3299,17 @@ return defaultArgument_()
4177
3299
  }));
4178
3300
  if((!ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_))) {
4179
3301
  ff_core_Option.Option_each(ff_core_Array.Array_first(remainingArguments_), ((_1) => {
4180
- {
4181
- const callAt_ = _1.at_;
4182
3302
  if(_1.name_.None) {
3303
+ const callAt_ = _1.at_;
4183
3304
  ff_compiler_Inference.fail_(callAt_, "Too many arguments")
4184
3305
  return
4185
3306
  }
4186
- }
4187
- {
4188
- const callAt_ = _1.at_;
4189
3307
  if(_1.name_.Some) {
3308
+ const callAt_ = _1.at_;
4190
3309
  const n_ = _1.name_.value_;
4191
3310
  ff_compiler_Inference.fail_(callAt_, ("Unknown argument: " + n_))
4192
3311
  return
4193
3312
  }
4194
- }
4195
3313
  }));
4196
3314
  return newArguments_
4197
3315
  } else {
@@ -4201,7 +3319,6 @@ const _1 = a_;
4201
3319
  {
4202
3320
  const _c = _1;
4203
3321
  return ff_compiler_Syntax.Argument(_c.at_, _c.name_, ff_compiler_Inference.Inference_inferTerm(self_, environment_, ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, a_.at_), a_.value_))
4204
- return
4205
3322
  }
4206
3323
  }
4207
3324
  }))]
@@ -4264,7 +3381,6 @@ const _1 = p_;
4264
3381
  {
4265
3382
  const _c = _1;
4266
3383
  return ff_compiler_Syntax.Parameter(_c.at_, _c.mutable_, _c.name_, ff_compiler_Unification.Unification_instantiate(self_.unification_, instantiationMap_, p_.valueType_), _c.default_)
4267
- return
4268
3384
  }
4269
3385
  }
4270
3386
  }));
@@ -4285,14 +3401,12 @@ return ff_compiler_Environment.Scheme(_c.isVariable_, _c.isMutable_, _c.isNewtyp
4285
3401
  if((ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, at_) || ff_compiler_LspHook.LspHook_isDefinedAt(self_.lspHook_, scheme_.signature_.at_))) {
4286
3402
  const symbolHook_ = ff_compiler_LspHook.SymbolHook(symbol_, at_, scheme_.signature_.at_);
4287
3403
  const emittedHook_ = (((_1) => {
4288
- {
4289
3404
  if(_1.InferLookupHook) {
4290
3405
  const h_ = _1;
4291
3406
  h_.symbol_.value_ = symbolHook_;
4292
3407
  h_.instantiated_.value_ = ff_core_Option.Some(instantiated_)
4293
3408
  return
4294
3409
  }
4295
- }
4296
3410
  {
4297
3411
 
4298
3412
  return