firefly-compiler 0.4.18 → 0.4.19
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.
- package/compiler/Builder.ff +1 -1
- package/compiler/Compiler.ff +6 -5
- package/compiler/Inference.ff +31 -19
- package/compiler/JsEmitter.ff +98 -71
- package/compiler/JsImporter.ff +1 -1
- package/compiler/LspHook.ff +4 -4
- package/compiler/Main.ff +6 -6
- package/compiler/Parser.ff +39 -39
- package/compiler/Patterns.ff +2 -0
- package/compiler/Syntax.ff +1 -1
- package/compiler/Tokenizer.ff +2 -2
- package/compiler/Workspace.ff +2 -2
- package/core/Array.ff +135 -294
- package/core/Buffer.ff +3 -3
- package/core/BuildSystem.ff +1 -1
- package/core/Equal.ff +36 -52
- package/core/HttpClient.ff +1 -1
- package/core/IntMap.ff +14 -18
- package/core/JsSystem.ff +1 -1
- package/core/JsValue.ff +6 -12
- package/core/Json.ff +19 -28
- package/core/List.ff +281 -312
- package/core/Map.ff +4 -8
- package/core/NodeSystem.ff +2 -2
- package/core/Option.ff +0 -4
- package/core/Ordering.ff +10 -6
- package/core/Pair.ff +0 -4
- package/core/Random.ff +12 -26
- package/core/RbMap.ff +216 -216
- package/core/Serializable.ff +9 -18
- package/core/Set.ff +0 -1
- package/core/SourceLocation.ff +1 -1
- package/core/Stack.ff +32 -45
- package/core/Stream.ff +10 -14
- package/core/String.ff +24 -6
- package/core/StringMap.ff +15 -19
- package/guide/Main.ff +20 -2
- package/lsp/CompletionHandler.ff +4 -4
- package/lsp/Handler.ff +44 -33
- package/lsp/HoverHandler.ff +2 -2
- package/lsp/LanguageServer.ff +2 -2
- package/lsp/SignatureHelpHandler.ff +1 -1
- package/lsp/SymbolHandler.ff +1 -1
- package/lux/Lux.ff +3 -3
- package/output/js/ff/compiler/Builder.mjs +19 -21
- package/output/js/ff/compiler/Compiler.mjs +18 -20
- package/output/js/ff/compiler/Dependencies.mjs +8 -10
- package/output/js/ff/compiler/Deriver.mjs +234 -236
- package/output/js/ff/compiler/Dictionaries.mjs +6 -8
- package/output/js/ff/compiler/Environment.mjs +42 -44
- package/output/js/ff/compiler/Inference.mjs +346 -304
- package/output/js/ff/compiler/JsEmitter.mjs +907 -833
- package/output/js/ff/compiler/JsImporter.mjs +0 -2
- package/output/js/ff/compiler/LspHook.mjs +10 -12
- package/output/js/ff/compiler/Main.mjs +109 -111
- package/output/js/ff/compiler/Parser.mjs +405 -407
- package/output/js/ff/compiler/Patterns.mjs +64 -50
- package/output/js/ff/compiler/Resolver.mjs +36 -38
- package/output/js/ff/compiler/Substitution.mjs +4 -6
- package/output/js/ff/compiler/Syntax.mjs +160 -162
- package/output/js/ff/compiler/Token.mjs +52 -54
- package/output/js/ff/compiler/Tokenizer.mjs +16 -18
- package/output/js/ff/compiler/Unification.mjs +24 -26
- package/output/js/ff/compiler/Wildcards.mjs +0 -2
- package/output/js/ff/compiler/Workspace.mjs +18 -20
- package/output/js/ff/core/Any.mjs +0 -2
- package/output/js/ff/core/Array.mjs +216 -613
- package/output/js/ff/core/AssetSystem.mjs +2 -4
- package/output/js/ff/core/Atomic.mjs +0 -2
- package/output/js/ff/core/Bool.mjs +0 -2
- package/output/js/ff/core/Box.mjs +0 -2
- package/output/js/ff/core/BrowserSystem.mjs +0 -2
- package/output/js/ff/core/Buffer.mjs +0 -2
- package/output/js/ff/core/BuildSystem.mjs +12 -14
- package/output/js/ff/core/Channel.mjs +0 -2
- package/output/js/ff/core/Char.mjs +0 -2
- package/output/js/ff/core/Core.mjs +0 -2
- package/output/js/ff/core/Duration.mjs +0 -2
- package/output/js/ff/core/Equal.mjs +0 -22
- package/output/js/ff/core/Error.mjs +0 -2
- package/output/js/ff/core/FileHandle.mjs +0 -2
- package/output/js/ff/core/Float.mjs +0 -2
- package/output/js/ff/core/HttpClient.mjs +2 -4
- package/output/js/ff/core/Instant.mjs +0 -2
- package/output/js/ff/core/Int.mjs +8 -10
- package/output/js/ff/core/IntMap.mjs +32 -42
- package/output/js/ff/core/JsSystem.mjs +1 -3
- package/output/js/ff/core/JsValue.mjs +5 -12
- package/output/js/ff/core/Json.mjs +23 -56
- package/output/js/ff/core/List.mjs +648 -1989
- package/output/js/ff/core/Lock.mjs +0 -2
- package/output/js/ff/core/Log.mjs +0 -2
- package/output/js/ff/core/Map.mjs +10 -20
- package/output/js/ff/core/NodeSystem.mjs +6 -8
- package/output/js/ff/core/Nothing.mjs +0 -2
- package/output/js/ff/core/Option.mjs +8 -18
- package/output/js/ff/core/Ordering.mjs +20 -98
- package/output/js/ff/core/Pair.mjs +6 -16
- package/output/js/ff/core/Path.mjs +12 -14
- package/output/js/ff/core/Random.mjs +24 -54
- package/output/js/ff/core/RbMap.mjs +54 -56
- package/output/js/ff/core/Serializable.mjs +19 -36
- package/output/js/ff/core/Set.mjs +0 -14
- package/output/js/ff/core/Show.mjs +0 -2
- package/output/js/ff/core/SourceLocation.mjs +0 -2
- package/output/js/ff/core/Stream.mjs +34 -44
- package/output/js/ff/core/String.mjs +31 -5
- package/output/js/ff/core/StringMap.mjs +32 -42
- package/output/js/ff/core/Task.mjs +0 -2
- package/output/js/ff/core/Try.mjs +0 -2
- package/output/js/ff/core/Unit.mjs +0 -2
- package/package.json +1 -1
- package/vscode/package.json +1 -1
- package/webserver/WebServer.ff +8 -8
- package/output/js/ff/core/Stack.mjs +0 -603
|
@@ -90,8 +90,6 @@ import * as ff_core_Show from "../../ff/core/Show.mjs"
|
|
|
90
90
|
|
|
91
91
|
import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
|
|
92
92
|
|
|
93
|
-
import * as ff_core_Stack from "../../ff/core/Stack.mjs"
|
|
94
|
-
|
|
95
93
|
import * as ff_core_Stream from "../../ff/core/Stream.mjs"
|
|
96
94
|
|
|
97
95
|
import * as ff_core_String from "../../ff/core/String.mjs"
|
|
@@ -142,7 +140,7 @@ return
|
|
|
142
140
|
}
|
|
143
141
|
}
|
|
144
142
|
}))(ff_core_List.List_grabFirst(c_.generics_));
|
|
145
|
-
return ff_core_Pair.Pair(ff_compiler_Unification.InstanceKey(c_.name_, typeName_), ff_compiler_Unification.InstanceValue(
|
|
143
|
+
return ff_core_Pair.Pair(ff_compiler_Unification.InstanceKey(c_.name_, typeName_), ff_compiler_Unification.InstanceValue([], [], ff_compiler_Syntax.PackagePair("", ""), "", c_.name_, c_.generics_))
|
|
146
144
|
})), ff_compiler_Unification.ff_core_Ordering_Order$ff_compiler_Unification_InstanceKey)
|
|
147
145
|
}
|
|
148
146
|
|
|
@@ -177,7 +175,7 @@ return
|
|
|
177
175
|
}
|
|
178
176
|
}
|
|
179
177
|
}))(ff_core_List.List_grabFirst(c_.generics_));
|
|
180
|
-
return ff_core_Pair.Pair(ff_compiler_Unification.InstanceKey(c_.name_, typeName_), ff_compiler_Unification.InstanceValue(
|
|
178
|
+
return ff_core_Pair.Pair(ff_compiler_Unification.InstanceKey(c_.name_, typeName_), ff_compiler_Unification.InstanceValue([], [], ff_compiler_Syntax.PackagePair("", ""), "", c_.name_, c_.generics_))
|
|
181
179
|
})), ff_compiler_Unification.ff_core_Ordering_Order$ff_compiler_Unification_InstanceKey)
|
|
182
180
|
}
|
|
183
181
|
|
|
@@ -309,7 +307,7 @@ export function Inference_inferExtendDefinition(self_, environment_, definition_
|
|
|
309
307
|
const selfParameter_ = ff_compiler_Syntax.Parameter(definition_.at_, false, definition_.name_, definition_.type_, ff_core_Option.None());
|
|
310
308
|
const functions_ = ff_core_List.List_map(definition_.methods_, ((method_) => {
|
|
311
309
|
const signature_ = (((_c) => {
|
|
312
|
-
return ff_compiler_Syntax.Signature(_c.at_, _c.name_, _c.member_,
|
|
310
|
+
return ff_compiler_Syntax.Signature(_c.at_, _c.name_, _c.member_, [...definition_.generics_, ...method_.signature_.generics_], [...definition_.constraints_, ...method_.signature_.constraints_], [selfParameter_, ...method_.signature_.parameters_], _c.returnType_, _c.effect_)
|
|
313
311
|
}))(method_.signature_);
|
|
314
312
|
const body_ = ff_compiler_Syntax.Target_mapFirefly(method_.body_, ((lambda_) => {
|
|
315
313
|
{
|
|
@@ -321,7 +319,7 @@ return ff_compiler_Syntax.Lambda(_c.at_, _c.effect_, ff_core_List.List_map(lambd
|
|
|
321
319
|
const _1 = case_;
|
|
322
320
|
{
|
|
323
321
|
const _c = _1;
|
|
324
|
-
return ff_compiler_Syntax.MatchCase(_c.at_,
|
|
322
|
+
return ff_compiler_Syntax.MatchCase(_c.at_, [ff_compiler_Syntax.PVariable(method_.at_, ff_core_Option.None()), ...case_.patterns_], _c.guards_, _c.body_)
|
|
325
323
|
return
|
|
326
324
|
}
|
|
327
325
|
}
|
|
@@ -352,8 +350,8 @@ if(ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, definition_.at_)) {
|
|
|
352
350
|
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferFunctionDefinitionHook(self_.unification_, environment_, definition_, self_.missing_))
|
|
353
351
|
};
|
|
354
352
|
const parameters_ = ff_core_List.List_map(definition_.signature_.parameters_, ((p_) => {
|
|
355
|
-
const noEffect_ = ff_compiler_Syntax.TConstructor(p_.at_, "ff:core/Nothing.Nothing",
|
|
356
|
-
const scheme_ = ff_compiler_Environment.Scheme(true, false, false, false, ff_compiler_Syntax.Signature(p_.at_, p_.name_, false,
|
|
353
|
+
const noEffect_ = ff_compiler_Syntax.TConstructor(p_.at_, "ff:core/Nothing.Nothing", []);
|
|
354
|
+
const scheme_ = ff_compiler_Environment.Scheme(true, false, false, false, ff_compiler_Syntax.Signature(p_.at_, p_.name_, false, [], [], [], p_.valueType_, noEffect_));
|
|
357
355
|
if(ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, p_.at_)) {
|
|
358
356
|
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferParameterHook(self_.unification_, environment_, p_, self_.missing_))
|
|
359
357
|
};
|
|
@@ -366,7 +364,7 @@ return ff_compiler_Environment.Environment(_c.modulePrefix_, ff_core_Map.Map_add
|
|
|
366
364
|
const parameterTypes_ = ff_core_List.List_map(parameters_, ((_w1) => {
|
|
367
365
|
return _w1.second_.signature_.returnType_
|
|
368
366
|
}));
|
|
369
|
-
const functionType_ = ff_compiler_Syntax.TConstructor(definition_.at_, ("Function$" + ff_core_List.List_size(parameterTypes_)),
|
|
367
|
+
const functionType_ = ff_compiler_Syntax.TConstructor(definition_.at_, ("Function$" + ff_core_List.List_size(parameterTypes_)), [definition_.signature_.effect_, ...parameterTypes_, definition_.signature_.returnType_]);
|
|
370
368
|
const instances_ = ff_compiler_Inference.constraintsToInstances_(definition_.signature_.constraints_);
|
|
371
369
|
return ff_compiler_Unification.Unification_withLocalInstances(self_.unification_, instances_, (() => {
|
|
372
370
|
{
|
|
@@ -396,7 +394,7 @@ const _1 = ff_core_List.List_grabLast(ts_);
|
|
|
396
394
|
{
|
|
397
395
|
if(_1.TConstructor) {
|
|
398
396
|
const n_ = _1.name_;
|
|
399
|
-
if(_1.generics_.
|
|
397
|
+
if(_1.generics_.length === 0) {
|
|
400
398
|
return (n_ === unitName_)
|
|
401
399
|
return
|
|
402
400
|
}
|
|
@@ -423,7 +421,7 @@ const cases_ = ((!returnsUnit_)
|
|
|
423
421
|
const _1 = c_;
|
|
424
422
|
{
|
|
425
423
|
const _c = _1;
|
|
426
|
-
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_,
|
|
424
|
+
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())))
|
|
427
425
|
return
|
|
428
426
|
}
|
|
429
427
|
}
|
|
@@ -448,7 +446,7 @@ const parameterTypes_ = ff_core_List.List_map(case_.patterns_, ((_w1) => {
|
|
|
448
446
|
return ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, _w1.at_)
|
|
449
447
|
}));
|
|
450
448
|
const returnType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, case_.at_);
|
|
451
|
-
const functionType_ = ff_compiler_Syntax.TConstructor(case_.at_, ("Function$" + ff_core_List.List_size(case_.patterns_)),
|
|
449
|
+
const functionType_ = ff_compiler_Syntax.TConstructor(case_.at_, ("Function$" + ff_core_List.List_size(case_.patterns_)), [environment_.effect_, ...parameterTypes_, returnType_]);
|
|
452
450
|
ff_compiler_Unification.Unification_unify(self_.unification_, case_.at_, expected_, functionType_);
|
|
453
451
|
const environment1_ = ff_core_List.List_foldLeft(ff_core_List.List_zip(parameterTypes_, case_.patterns_), environment_, ((_1, _2) => {
|
|
454
452
|
{
|
|
@@ -460,8 +458,8 @@ const symbols_ = ff_core_Map.Map_mapValues(ff_compiler_Inference.Inference_infer
|
|
|
460
458
|
const name_ = _1;
|
|
461
459
|
const at_ = _2.first_;
|
|
462
460
|
const type_ = _2.second_;
|
|
463
|
-
const noEffect_ = ff_compiler_Syntax.TConstructor(at_, "ff:core/Nothing.Nothing",
|
|
464
|
-
return ff_compiler_Environment.Scheme(true, false, false, false, ff_compiler_Syntax.Signature(at_, name_, false,
|
|
461
|
+
const noEffect_ = ff_compiler_Syntax.TConstructor(at_, "ff:core/Nothing.Nothing", []);
|
|
462
|
+
return ff_compiler_Environment.Scheme(true, false, false, false, ff_compiler_Syntax.Signature(at_, name_, false, [], [], [], type_, noEffect_))
|
|
465
463
|
return
|
|
466
464
|
}
|
|
467
465
|
}), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
|
|
@@ -476,7 +474,7 @@ return
|
|
|
476
474
|
return
|
|
477
475
|
}
|
|
478
476
|
}));
|
|
479
|
-
|
|
477
|
+
const guards_ = ff_core_List.List_toArray([]);
|
|
480
478
|
const environment3_ = ff_core_List.List_foldLeft(case_.guards_, environment1_, ((environment2_, g_) => {
|
|
481
479
|
const guardType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, g_.at_);
|
|
482
480
|
const guardTerm_ = ff_compiler_Inference.Inference_inferTerm(self_, environment2_, guardType_, g_.term_);
|
|
@@ -485,14 +483,14 @@ const symbols_ = ff_core_Map.Map_mapValues(ff_compiler_Inference.Inference_infer
|
|
|
485
483
|
const name_ = _1;
|
|
486
484
|
const at_ = _2.first_;
|
|
487
485
|
const type_ = _2.second_;
|
|
488
|
-
const noEffect_ = ff_compiler_Syntax.TConstructor(at_, "ff:core/Nothing.Nothing",
|
|
489
|
-
return ff_compiler_Environment.Scheme(true, false, false, false, ff_compiler_Syntax.Signature(at_, name_, false,
|
|
486
|
+
const noEffect_ = ff_compiler_Syntax.TConstructor(at_, "ff:core/Nothing.Nothing", []);
|
|
487
|
+
return ff_compiler_Environment.Scheme(true, false, false, false, ff_compiler_Syntax.Signature(at_, name_, false, [], [], [], type_, noEffect_))
|
|
490
488
|
return
|
|
491
489
|
}
|
|
492
490
|
}), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
|
|
493
|
-
guards_
|
|
491
|
+
ff_core_Array.Array_push(guards_, (((_c) => {
|
|
494
492
|
return ff_compiler_Syntax.MatchGuard(_c.at_, guardTerm_, _c.pattern_)
|
|
495
|
-
}))(g_)
|
|
493
|
+
}))(g_));
|
|
496
494
|
{
|
|
497
495
|
const _1 = environment2_;
|
|
498
496
|
{
|
|
@@ -506,7 +504,7 @@ return
|
|
|
506
504
|
const _1 = case_;
|
|
507
505
|
{
|
|
508
506
|
const _c = _1;
|
|
509
|
-
return ff_compiler_Syntax.MatchCase(_c.at_, _c.patterns_,
|
|
507
|
+
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_))
|
|
510
508
|
return
|
|
511
509
|
}
|
|
512
510
|
}
|
|
@@ -539,7 +537,7 @@ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferPatter
|
|
|
539
537
|
}
|
|
540
538
|
};
|
|
541
539
|
function literal_(coreTypeName_) {
|
|
542
|
-
ff_compiler_Unification.Unification_unify(self_.unification_, pattern_.at_, expected_, ff_compiler_Syntax.TConstructor(pattern_.at_, ff_compiler_Inference.core_(coreTypeName_),
|
|
540
|
+
ff_compiler_Unification.Unification_unify(self_.unification_, pattern_.at_, expected_, ff_compiler_Syntax.TConstructor(pattern_.at_, ff_compiler_Inference.core_(coreTypeName_), []));
|
|
543
541
|
return ff_core_Map.empty_()
|
|
544
542
|
}
|
|
545
543
|
{
|
|
@@ -576,7 +574,7 @@ if(_1.PVariable) {
|
|
|
576
574
|
const at_ = _1.at_;
|
|
577
575
|
if(_1.name_.Some) {
|
|
578
576
|
const name_ = _1.name_.value_;
|
|
579
|
-
return ff_core_List.List_toMap(
|
|
577
|
+
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)
|
|
580
578
|
return
|
|
581
579
|
}
|
|
582
580
|
}
|
|
@@ -596,7 +594,7 @@ const at_ = _1.at_;
|
|
|
596
594
|
const name_ = _1.name_;
|
|
597
595
|
const variableAt_ = _1.variableAt_;
|
|
598
596
|
const variableOption_ = _1.variable_;
|
|
599
|
-
const instantiated_ = ff_core_Option.Option_else(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, at_, name_,
|
|
597
|
+
const instantiated_ = ff_core_Option.Option_else(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, at_, name_, [], ff_core_Option.None()), (() => {
|
|
600
598
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ("No such variant: " + name_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
601
599
|
}));
|
|
602
600
|
if(instantiated_.scheme_.isNewtype_) {
|
|
@@ -620,9 +618,45 @@ return
|
|
|
620
618
|
{
|
|
621
619
|
if(_1.PVariant) {
|
|
622
620
|
const at_ = _1.at_;
|
|
621
|
+
if(_1.name_ === "List$Empty") {
|
|
622
|
+
if(_1.patterns_.length === 0) {
|
|
623
|
+
const itemType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, at_);
|
|
624
|
+
const listType_ = ff_compiler_Syntax.TConstructor(at_, ff_compiler_Inference.core_("List"), [itemType_]);
|
|
625
|
+
ff_compiler_Unification.Unification_unify(self_.unification_, at_, expected_, listType_);
|
|
626
|
+
return ff_core_List.List_toMap([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
|
|
627
|
+
return
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
{
|
|
633
|
+
if(_1.PVariant) {
|
|
634
|
+
const at_ = _1.at_;
|
|
635
|
+
if(_1.name_ === "List$Link") {
|
|
636
|
+
if(_1.patterns_.length > 0) {
|
|
637
|
+
const head_ = _1.patterns_[0];
|
|
638
|
+
if(_1.patterns_.length > 1) {
|
|
639
|
+
const tail_ = _1.patterns_[1];
|
|
640
|
+
if(_1.patterns_.length === 2) {
|
|
641
|
+
const itemType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, at_);
|
|
642
|
+
const listType_ = ff_compiler_Syntax.TConstructor(at_, ff_compiler_Inference.core_("List"), [itemType_]);
|
|
643
|
+
ff_compiler_Unification.Unification_unify(self_.unification_, at_, expected_, listType_);
|
|
644
|
+
const headVariables_ = ff_compiler_Inference.Inference_inferPattern(self_, environment_, itemType_, head_);
|
|
645
|
+
const tailVariables_ = ff_compiler_Inference.Inference_inferPattern(self_, environment_, listType_, tail_);
|
|
646
|
+
return ff_core_Map.Map_addAll(headVariables_, tailVariables_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
|
|
647
|
+
return
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
{
|
|
655
|
+
if(_1.PVariant) {
|
|
656
|
+
const at_ = _1.at_;
|
|
623
657
|
const name_ = _1.name_;
|
|
624
658
|
const patterns_ = _1.patterns_;
|
|
625
|
-
const instantiated_ = ff_core_Option.Option_else(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, at_, name_,
|
|
659
|
+
const instantiated_ = ff_core_Option.Option_else(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, at_, name_, [], ff_core_Option.None()), (() => {
|
|
626
660
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ("No such variant: " + name_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
627
661
|
}));
|
|
628
662
|
ff_compiler_Unification.Unification_unify(self_.unification_, at_, expected_, instantiated_.scheme_.signature_.returnType_);
|
|
@@ -654,7 +688,7 @@ return box_
|
|
|
654
688
|
})())
|
|
655
689
|
: ff_core_Option.None());
|
|
656
690
|
function literal_(coreTypeName_) {
|
|
657
|
-
ff_compiler_Unification.Unification_unify(self_.unification_, term_.at_, expected_, ff_compiler_Syntax.TConstructor(term_.at_, ff_compiler_Inference.core_(coreTypeName_),
|
|
691
|
+
ff_compiler_Unification.Unification_unify(self_.unification_, term_.at_, expected_, ff_compiler_Syntax.TConstructor(term_.at_, ff_compiler_Inference.core_(coreTypeName_), []));
|
|
658
692
|
return term_
|
|
659
693
|
}
|
|
660
694
|
{
|
|
@@ -686,7 +720,7 @@ return
|
|
|
686
720
|
{
|
|
687
721
|
if(_1.EVariable) {
|
|
688
722
|
const e_ = _1;
|
|
689
|
-
return ff_core_Option.Option_else(ff_core_Option.Option_map(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, e_.name_,
|
|
723
|
+
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_) => {
|
|
690
724
|
if(instantiated_.scheme_.isVariable_) {
|
|
691
725
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, instantiated_.scheme_.signature_.returnType_);
|
|
692
726
|
return term_
|
|
@@ -723,7 +757,7 @@ const symbolHook_ = ff_compiler_LspHook.SymbolHook(e_.field_, e_.at_, e_.at_);
|
|
|
723
757
|
const noEffect_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
|
|
724
758
|
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferRecordFieldHook(self_.unification_, environment_, expected_, t_, e_.field_))
|
|
725
759
|
};
|
|
726
|
-
const fieldNames_ = ff_core_List.List_dropFirst(
|
|
760
|
+
const fieldNames_ = ff_core_List.List_dropFirst(ff_core_String.String_split(name_, 36), 1);
|
|
727
761
|
return ff_core_Option.Option_else(ff_core_Option.Option_elseIf(ff_core_Option.Option_map(ff_core_Option.Option_map(ff_core_List.List_find(ff_core_List.List_pairs(fieldNames_), ((_w1) => {
|
|
728
762
|
return (_w1.second_ === e_.field_)
|
|
729
763
|
})), ((_w1) => {
|
|
@@ -744,7 +778,7 @@ return ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)
|
|
|
744
778
|
}), (() => {
|
|
745
779
|
return term_
|
|
746
780
|
})), (() => {
|
|
747
|
-
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_,
|
|
781
|
+
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)})
|
|
748
782
|
}))
|
|
749
783
|
return
|
|
750
784
|
}
|
|
@@ -790,7 +824,7 @@ return
|
|
|
790
824
|
}
|
|
791
825
|
{
|
|
792
826
|
if(_1.None) {
|
|
793
|
-
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_,
|
|
827
|
+
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)})
|
|
794
828
|
return
|
|
795
829
|
}
|
|
796
830
|
}
|
|
@@ -821,7 +855,7 @@ return
|
|
|
821
855
|
{
|
|
822
856
|
if(_1.EWildcard) {
|
|
823
857
|
const e_ = _1;
|
|
824
|
-
return ff_core_Option.Option_grab(ff_core_Option.Option_map(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, ("_w" + e_.index_),
|
|
858
|
+
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_) => {
|
|
825
859
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, instantiated_.scheme_.signature_.returnType_);
|
|
826
860
|
return term_
|
|
827
861
|
})))
|
|
@@ -833,7 +867,7 @@ if(_1.EList) {
|
|
|
833
867
|
const at_ = _1.at_;
|
|
834
868
|
const t_ = _1.elementType_;
|
|
835
869
|
const items_ = _1.items_;
|
|
836
|
-
const listType_ = ff_compiler_Syntax.TConstructor(term_.at_, ff_compiler_Inference.core_("List"),
|
|
870
|
+
const listType_ = ff_compiler_Syntax.TConstructor(term_.at_, ff_compiler_Inference.core_("List"), [t_]);
|
|
837
871
|
ff_compiler_Unification.Unification_unify(self_.unification_, at_, expected_, listType_);
|
|
838
872
|
return ff_compiler_Syntax.EList(at_, t_, ff_core_List.List_map(items_, ((_1) => {
|
|
839
873
|
{
|
|
@@ -869,7 +903,7 @@ const at2_ = _1.function_.at_;
|
|
|
869
903
|
const at3_ = _1.function_.lambda_.at_;
|
|
870
904
|
const effect3_ = _1.function_.lambda_.effect_;
|
|
871
905
|
const cases_ = _1.function_.lambda_.cases_;
|
|
872
|
-
const e_ = ff_compiler_Syntax.EVariant(at_, "ff:core/Unit.Unit",
|
|
906
|
+
const e_ = ff_compiler_Syntax.EVariant(at_, "ff:core/Unit.Unit", [], ff_core_Option.None());
|
|
873
907
|
const newCases_ = ff_core_List.List_map(cases_, ((case_) => {
|
|
874
908
|
{
|
|
875
909
|
const _1 = case_;
|
|
@@ -886,8 +920,8 @@ const _1 = after_;
|
|
|
886
920
|
{
|
|
887
921
|
if(_1.EVariant) {
|
|
888
922
|
const at_ = _1.at_;
|
|
889
|
-
if(_1.name_
|
|
890
|
-
const unitType_ = ff_compiler_Syntax.TConstructor(at_, ff_compiler_Inference.core_("Unit"),
|
|
923
|
+
if(_1.name_ === "ff:core/Unit.Unit") {
|
|
924
|
+
const unitType_ = ff_compiler_Syntax.TConstructor(at_, ff_compiler_Inference.core_("Unit"), []);
|
|
891
925
|
ff_compiler_Unification.Unification_unify(self_.unification_, at_, expected_, unitType_);
|
|
892
926
|
return ff_compiler_Inference.Inference_inferTerm(self_, environment_, newExpected_, newPipe_)
|
|
893
927
|
return
|
|
@@ -914,8 +948,8 @@ return
|
|
|
914
948
|
{
|
|
915
949
|
if(_1.ELet) {
|
|
916
950
|
const e_ = _1;
|
|
917
|
-
const noEffect_ = ff_compiler_Syntax.TConstructor(e_.at_, "ff:core/Nothing.Nothing",
|
|
918
|
-
const scheme_ = ff_compiler_Environment.Scheme(true, e_.mutable_, false, false, ff_compiler_Syntax.Signature(e_.at_, e_.name_, false,
|
|
951
|
+
const noEffect_ = ff_compiler_Syntax.TConstructor(e_.at_, "ff:core/Nothing.Nothing", []);
|
|
952
|
+
const scheme_ = ff_compiler_Environment.Scheme(true, e_.mutable_, false, false, ff_compiler_Syntax.Signature(e_.at_, e_.name_, false, [], [], [], e_.valueType_, noEffect_));
|
|
919
953
|
const environment2_ = (((_c) => {
|
|
920
954
|
return ff_compiler_Environment.Environment(_c.modulePrefix_, ff_core_Map.Map_add(environment_.symbols_, e_.name_, scheme_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), _c.traits_, _c.imports_, _c.effect_, _c.selfVariable_)
|
|
921
955
|
}))(environment_);
|
|
@@ -937,13 +971,13 @@ const l_ = _1.lambda_;
|
|
|
937
971
|
do {
|
|
938
972
|
const _1 = l_.cases_;
|
|
939
973
|
{
|
|
940
|
-
if(_1.
|
|
941
|
-
if(_1.
|
|
942
|
-
if(_1.
|
|
943
|
-
if(_1.
|
|
944
|
-
const insideAt_ = _1.
|
|
945
|
-
if(_1.
|
|
946
|
-
if(_1.
|
|
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) {
|
|
978
|
+
const insideAt_ = _1[0].body_.at_;
|
|
979
|
+
if(_1[0].body_.name_ === "") {
|
|
980
|
+
if(_1.length === 1) {
|
|
947
981
|
const _guard1 = ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, insideAt_);
|
|
948
982
|
if(_guard1) {
|
|
949
983
|
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferLambdaStartHook(self_.unification_, environment_, expected_))
|
|
@@ -957,16 +991,16 @@ break
|
|
|
957
991
|
}
|
|
958
992
|
}
|
|
959
993
|
{
|
|
960
|
-
if(_1.
|
|
961
|
-
if(_1.
|
|
962
|
-
if(_1.
|
|
963
|
-
if(_1.
|
|
964
|
-
if(_1.
|
|
965
|
-
const insideAt_ = _1.
|
|
966
|
-
if(_1.
|
|
967
|
-
if(_1.
|
|
968
|
-
if(_1.
|
|
969
|
-
if(_1.
|
|
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) {
|
|
999
|
+
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) {
|
|
970
1004
|
const _guard1 = ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, insideAt_);
|
|
971
1005
|
if(_guard1) {
|
|
972
1006
|
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferLambdaStartHook(self_.unification_, environment_, expected_))
|
|
@@ -1029,7 +1063,7 @@ return _w1.name_
|
|
|
1029
1063
|
})), "$")), ff_core_List.List_map(parameters_, ((_w1) => {
|
|
1030
1064
|
return _w1.valueType_
|
|
1031
1065
|
})));
|
|
1032
|
-
const functionType_ = ff_compiler_Syntax.TConstructor(e_.at_, "Function$1",
|
|
1066
|
+
const functionType_ = ff_compiler_Syntax.TConstructor(e_.at_, "Function$1", [ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_), instantiated_.scheme_.signature_.returnType_, ff_compiler_Syntax.TConstructor(e_.at_, ff_compiler_Inference.core_("Option"), [recordType_])]);
|
|
1033
1067
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, functionType_);
|
|
1034
1068
|
{
|
|
1035
1069
|
const _1 = e_;
|
|
@@ -1047,7 +1081,7 @@ return
|
|
|
1047
1081
|
{
|
|
1048
1082
|
if(_1.ECopy) {
|
|
1049
1083
|
const e_ = _1;
|
|
1050
|
-
const scheme_ = ff_core_Option.Option_else(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, e_.name_,
|
|
1084
|
+
const scheme_ = ff_core_Option.Option_else(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, e_.name_, [], ff_core_Option.None()), (() => {
|
|
1051
1085
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(e_.at_, ("Symbol not in scope: " + e_.name_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
1052
1086
|
})).scheme_;
|
|
1053
1087
|
if(scheme_.isNewtype_) {
|
|
@@ -1114,9 +1148,9 @@ return ff_compiler_Syntax.Location((e_.at_.file_ + "/<copy>"), _c.line_, _c.colu
|
|
|
1114
1148
|
return ff_compiler_Syntax.Argument(at_, ff_core_Option.Some(name_), ff_compiler_Syntax.EField(at_, false, ff_compiler_Syntax.EVariable(at_, "_c"), name_))
|
|
1115
1149
|
}))
|
|
1116
1150
|
}));
|
|
1117
|
-
const body_ = ff_compiler_Syntax.EVariant(e_.at_, e_.name_,
|
|
1151
|
+
const body_ = ff_compiler_Syntax.EVariant(e_.at_, e_.name_, [], ff_core_Option.Some(arguments_));
|
|
1118
1152
|
const effect_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
|
|
1119
|
-
const e1_ = ff_compiler_Syntax.EPipe(e_.at_, e_.record_, effect_, ff_compiler_Syntax.ELambda(e_.at_, ff_compiler_Syntax.Lambda(e_.at_, effect_,
|
|
1153
|
+
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_)])));
|
|
1120
1154
|
return ff_compiler_Inference.Inference_inferTerm(self_, environment_, expected_, e1_)
|
|
1121
1155
|
return
|
|
1122
1156
|
}
|
|
@@ -1125,7 +1159,7 @@ return
|
|
|
1125
1159
|
if(_1.EPipe) {
|
|
1126
1160
|
const e_ = _1;
|
|
1127
1161
|
const valueType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
|
|
1128
|
-
const functionType_ = ff_compiler_Syntax.TConstructor(e_.at_, "Function$1",
|
|
1162
|
+
const functionType_ = ff_compiler_Syntax.TConstructor(e_.at_, "Function$1", [e_.effect_, valueType_, expected_]);
|
|
1129
1163
|
const value_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, valueType_, e_.value_);
|
|
1130
1164
|
const function_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, functionType_, e_.function_);
|
|
1131
1165
|
ff_compiler_Unification.Unification_affect(self_.unification_, term_.at_, e_.effect_, environment_.effect_);
|
|
@@ -1232,9 +1266,9 @@ const t_ = _1;
|
|
|
1232
1266
|
if(_1.TConstructor) {
|
|
1233
1267
|
const name_ = _1.name_;
|
|
1234
1268
|
const methodName_ = ((name_ + "_") + f_.field_);
|
|
1235
|
-
const arguments_ =
|
|
1269
|
+
const arguments_ = [ff_compiler_Syntax.Argument(f_.record_.at_, ff_core_Option.None(), f_.record_), ...e_.arguments_];
|
|
1236
1270
|
{
|
|
1237
|
-
const _1 = ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, f_.at_, methodName_,
|
|
1271
|
+
const _1 = ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, f_.at_, methodName_, [], ff_core_Option.Some(arguments_));
|
|
1238
1272
|
{
|
|
1239
1273
|
if(_1.Some) {
|
|
1240
1274
|
const instantiated_ = _1.value_;
|
|
@@ -1254,7 +1288,7 @@ return
|
|
|
1254
1288
|
}
|
|
1255
1289
|
{
|
|
1256
1290
|
if(_1.None) {
|
|
1257
|
-
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_,
|
|
1291
|
+
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)})
|
|
1258
1292
|
return
|
|
1259
1293
|
}
|
|
1260
1294
|
}
|
|
@@ -1353,7 +1387,7 @@ return
|
|
|
1353
1387
|
{
|
|
1354
1388
|
if(_1.EAssign) {
|
|
1355
1389
|
const e_ = _1;
|
|
1356
|
-
return ff_core_Option.Option_else(ff_core_Option.Option_map(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, e_.variable_,
|
|
1390
|
+
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_) => {
|
|
1357
1391
|
if((instantiated_.scheme_.isMutable_ || ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_))) {
|
|
1358
1392
|
const value_ = ff_compiler_Inference.Inference_inferAssignment(self_, environment_, expected_, e_.at_, e_.operator_, e_.value_, instantiated_.scheme_.signature_);
|
|
1359
1393
|
{
|
|
@@ -1421,13 +1455,13 @@ return
|
|
|
1421
1455
|
{
|
|
1422
1456
|
if(_1.Some) {
|
|
1423
1457
|
const instantiated_ = _1.value_;
|
|
1424
|
-
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_,
|
|
1458
|
+
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)})
|
|
1425
1459
|
return
|
|
1426
1460
|
}
|
|
1427
1461
|
}
|
|
1428
1462
|
{
|
|
1429
1463
|
if(_1.None) {
|
|
1430
|
-
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_,
|
|
1464
|
+
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)})
|
|
1431
1465
|
return
|
|
1432
1466
|
}
|
|
1433
1467
|
}
|
|
@@ -1461,12 +1495,12 @@ return
|
|
|
1461
1495
|
export function Inference_inferAssignment(self_, environment_, expected_, at_, operator_, value_, signature_) {
|
|
1462
1496
|
const t_ = signature_.returnType_;
|
|
1463
1497
|
if(((operator_ === "+") || (operator_ === "-"))) {
|
|
1464
|
-
ff_compiler_Unification.Unification_unify(self_.unification_, at_, t_, ff_compiler_Syntax.TConstructor(at_, ff_compiler_Inference.core_("Int"),
|
|
1498
|
+
ff_compiler_Unification.Unification_unify(self_.unification_, at_, t_, ff_compiler_Syntax.TConstructor(at_, ff_compiler_Inference.core_("Int"), []))
|
|
1465
1499
|
} else if((operator_ !== "")) {
|
|
1466
1500
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, (("Only +=, -= and = assignments are supported. Got: " + operator_) + "=")), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
1467
1501
|
} else {};
|
|
1468
1502
|
const newValue_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, value_);
|
|
1469
|
-
ff_compiler_Unification.Unification_unify(self_.unification_, at_, expected_, ff_compiler_Syntax.TConstructor(at_, ff_compiler_Inference.core_("Unit"),
|
|
1503
|
+
ff_compiler_Unification.Unification_unify(self_.unification_, at_, expected_, ff_compiler_Syntax.TConstructor(at_, ff_compiler_Inference.core_("Unit"), []));
|
|
1470
1504
|
return newValue_
|
|
1471
1505
|
}
|
|
1472
1506
|
|
|
@@ -1511,7 +1545,7 @@ const _1 = e_;
|
|
|
1511
1545
|
const _c = _1;
|
|
1512
1546
|
return ff_compiler_Syntax.ECall(_c.at_, ff_compiler_Syntax.StaticCall(name_, call_.tailCall_, false), signature_.effect_, ff_core_List.List_map(instantiation_, ((_w1) => {
|
|
1513
1547
|
return _w1.second_
|
|
1514
|
-
})),
|
|
1548
|
+
})), [selfArgument_, ...arguments_], _c.dictionaries_)
|
|
1515
1549
|
return
|
|
1516
1550
|
}
|
|
1517
1551
|
}
|
|
@@ -1603,7 +1637,7 @@ const effect_ = ff_compiler_Unification.Unification_freshUnificationVariable(sel
|
|
|
1603
1637
|
const argumentTypes_ = ff_core_List.List_map(e_.arguments_, ((_w1) => {
|
|
1604
1638
|
return ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, _w1.at_)
|
|
1605
1639
|
}));
|
|
1606
|
-
const functionType_ = ff_compiler_Syntax.TConstructor(e_.at_, ("Function$" + ff_core_List.List_size(e_.arguments_)),
|
|
1640
|
+
const functionType_ = ff_compiler_Syntax.TConstructor(e_.at_, ("Function$" + ff_core_List.List_size(e_.arguments_)), [effect_, ...argumentTypes_, expected_]);
|
|
1607
1641
|
const function_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, functionType_, call_.function_);
|
|
1608
1642
|
const arguments_ = ff_core_List.List_map(ff_core_List.List_zip(e_.arguments_, argumentTypes_), ((_1) => {
|
|
1609
1643
|
{
|
|
@@ -1633,7 +1667,7 @@ const _1 = e_;
|
|
|
1633
1667
|
const _c = _1;
|
|
1634
1668
|
return ff_compiler_Syntax.ECall(_c.at_, (((_c) => {
|
|
1635
1669
|
return ff_compiler_Syntax.DynamicCall(function_, _c.tailCall_)
|
|
1636
|
-
}))(call_), effect_,
|
|
1670
|
+
}))(call_), effect_, [], arguments_, _c.dictionaries_)
|
|
1637
1671
|
return
|
|
1638
1672
|
}
|
|
1639
1673
|
}
|
|
@@ -1657,21 +1691,21 @@ const target_ = ff_compiler_Syntax.StaticCall(operator_, false, false);
|
|
|
1657
1691
|
{
|
|
1658
1692
|
const _1 = e_.arguments_;
|
|
1659
1693
|
{
|
|
1660
|
-
if(_1.
|
|
1661
|
-
const a1_ = _1
|
|
1662
|
-
if(_1.
|
|
1694
|
+
if(_1.length > 0) {
|
|
1695
|
+
const a1_ = _1[0];
|
|
1696
|
+
if(_1.length === 1) {
|
|
1663
1697
|
const _guard1 = (operator_ === "!");
|
|
1664
1698
|
if(_guard1) {
|
|
1665
|
-
const t_ = ff_compiler_Syntax.TConstructor(e_.at_, ff_compiler_Inference.core_("Bool"),
|
|
1699
|
+
const t_ = ff_compiler_Syntax.TConstructor(e_.at_, ff_compiler_Inference.core_("Bool"), []);
|
|
1666
1700
|
const e1_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, a1_.value_);
|
|
1667
1701
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t_);
|
|
1668
1702
|
{
|
|
1669
1703
|
const _1 = e_;
|
|
1670
1704
|
{
|
|
1671
1705
|
const _c = _1;
|
|
1672
|
-
return ff_compiler_Syntax.ECall(_c.at_, target_, _c.effect_, _c.typeArguments_,
|
|
1706
|
+
return ff_compiler_Syntax.ECall(_c.at_, target_, _c.effect_, _c.typeArguments_, [(((_c) => {
|
|
1673
1707
|
return ff_compiler_Syntax.Argument(_c.at_, _c.name_, e1_)
|
|
1674
|
-
}))(a1_),
|
|
1708
|
+
}))(a1_)], _c.dictionaries_)
|
|
1675
1709
|
return
|
|
1676
1710
|
}
|
|
1677
1711
|
}
|
|
@@ -1681,9 +1715,9 @@ return
|
|
|
1681
1715
|
}
|
|
1682
1716
|
}
|
|
1683
1717
|
{
|
|
1684
|
-
if(_1.
|
|
1685
|
-
const a1_ = _1
|
|
1686
|
-
if(_1.
|
|
1718
|
+
if(_1.length > 0) {
|
|
1719
|
+
const a1_ = _1[0];
|
|
1720
|
+
if(_1.length === 1) {
|
|
1687
1721
|
const _guard1 = (operator_ === "-");
|
|
1688
1722
|
if(_guard1) {
|
|
1689
1723
|
const t1_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
|
|
@@ -1693,7 +1727,7 @@ const _1 = ff_compiler_Unification.Unification_substitute(self_.unification_, t1
|
|
|
1693
1727
|
{
|
|
1694
1728
|
if(_1.TConstructor) {
|
|
1695
1729
|
const name_ = _1.name_;
|
|
1696
|
-
if(_1.generics_.
|
|
1730
|
+
if(_1.generics_.length === 0) {
|
|
1697
1731
|
const _guard1 = (name_ === ff_compiler_Inference.core_("Float"));
|
|
1698
1732
|
if(_guard1) {
|
|
1699
1733
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t1_)
|
|
@@ -1705,7 +1739,7 @@ break
|
|
|
1705
1739
|
{
|
|
1706
1740
|
if(_1.TConstructor) {
|
|
1707
1741
|
const name_ = _1.name_;
|
|
1708
|
-
if(_1.generics_.
|
|
1742
|
+
if(_1.generics_.length === 0) {
|
|
1709
1743
|
const _guard1 = (name_ === ff_compiler_Inference.core_("Int"));
|
|
1710
1744
|
if(_guard1) {
|
|
1711
1745
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t1_)
|
|
@@ -1730,9 +1764,9 @@ break
|
|
|
1730
1764
|
const _1 = e_;
|
|
1731
1765
|
{
|
|
1732
1766
|
const _c = _1;
|
|
1733
|
-
return ff_compiler_Syntax.ECall(_c.at_, target_, _c.effect_, _c.typeArguments_,
|
|
1767
|
+
return ff_compiler_Syntax.ECall(_c.at_, target_, _c.effect_, _c.typeArguments_, [(((_c) => {
|
|
1734
1768
|
return ff_compiler_Syntax.Argument(_c.at_, _c.name_, e1_)
|
|
1735
|
-
}))(a1_),
|
|
1769
|
+
}))(a1_)], _c.dictionaries_)
|
|
1736
1770
|
return
|
|
1737
1771
|
}
|
|
1738
1772
|
}
|
|
@@ -1742,14 +1776,14 @@ return
|
|
|
1742
1776
|
}
|
|
1743
1777
|
}
|
|
1744
1778
|
{
|
|
1745
|
-
if(_1.
|
|
1746
|
-
const a1_ = _1
|
|
1747
|
-
if(_1.
|
|
1748
|
-
const a2_ = _1
|
|
1749
|
-
if(_1.
|
|
1779
|
+
if(_1.length > 0) {
|
|
1780
|
+
const a1_ = _1[0];
|
|
1781
|
+
if(_1.length > 1) {
|
|
1782
|
+
const a2_ = _1[1];
|
|
1783
|
+
if(_1.length === 2) {
|
|
1750
1784
|
const _guard1 = ((operator_ === "||") || (operator_ === "&&"));
|
|
1751
1785
|
if(_guard1) {
|
|
1752
|
-
const t_ = ff_compiler_Syntax.TConstructor(e_.at_, ff_compiler_Inference.core_("Bool"),
|
|
1786
|
+
const t_ = ff_compiler_Syntax.TConstructor(e_.at_, ff_compiler_Inference.core_("Bool"), []);
|
|
1753
1787
|
const e1_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, a1_.value_);
|
|
1754
1788
|
const e2_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, a2_.value_);
|
|
1755
1789
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t_);
|
|
@@ -1757,11 +1791,11 @@ ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_,
|
|
|
1757
1791
|
const _1 = e_;
|
|
1758
1792
|
{
|
|
1759
1793
|
const _c = _1;
|
|
1760
|
-
return ff_compiler_Syntax.ECall(_c.at_, target_, _c.effect_, _c.typeArguments_,
|
|
1794
|
+
return ff_compiler_Syntax.ECall(_c.at_, target_, _c.effect_, _c.typeArguments_, [(((_c) => {
|
|
1761
1795
|
return ff_compiler_Syntax.Argument(_c.at_, _c.name_, e1_)
|
|
1762
|
-
}))(a1_),
|
|
1796
|
+
}))(a1_), (((_c) => {
|
|
1763
1797
|
return ff_compiler_Syntax.Argument(_c.at_, _c.name_, e2_)
|
|
1764
|
-
}))(a2_),
|
|
1798
|
+
}))(a2_)], _c.dictionaries_)
|
|
1765
1799
|
return
|
|
1766
1800
|
}
|
|
1767
1801
|
}
|
|
@@ -1772,26 +1806,26 @@ return
|
|
|
1772
1806
|
}
|
|
1773
1807
|
}
|
|
1774
1808
|
{
|
|
1775
|
-
if(_1.
|
|
1776
|
-
const a1_ = _1
|
|
1777
|
-
if(_1.
|
|
1778
|
-
const a2_ = _1
|
|
1779
|
-
if(_1.
|
|
1809
|
+
if(_1.length > 0) {
|
|
1810
|
+
const a1_ = _1[0];
|
|
1811
|
+
if(_1.length > 1) {
|
|
1812
|
+
const a2_ = _1[1];
|
|
1813
|
+
if(_1.length === 2) {
|
|
1780
1814
|
const _guard1 = ((operator_ === "===") || (operator_ === "!=="));
|
|
1781
1815
|
if(_guard1) {
|
|
1782
1816
|
const t1_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
|
|
1783
1817
|
const e1_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t1_, a1_.value_);
|
|
1784
1818
|
const e2_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t1_, a2_.value_);
|
|
1785
|
-
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, ff_compiler_Syntax.TConstructor(e_.at_, ff_compiler_Inference.core_("Bool"),
|
|
1819
|
+
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, ff_compiler_Syntax.TConstructor(e_.at_, ff_compiler_Inference.core_("Bool"), []));
|
|
1786
1820
|
{
|
|
1787
1821
|
const _1 = e_;
|
|
1788
1822
|
{
|
|
1789
1823
|
const _c = _1;
|
|
1790
|
-
return ff_compiler_Syntax.ECall(_c.at_, target_, _c.effect_, _c.typeArguments_,
|
|
1824
|
+
return ff_compiler_Syntax.ECall(_c.at_, target_, _c.effect_, _c.typeArguments_, [(((_c) => {
|
|
1791
1825
|
return ff_compiler_Syntax.Argument(_c.at_, _c.name_, e1_)
|
|
1792
|
-
}))(a1_),
|
|
1826
|
+
}))(a1_), (((_c) => {
|
|
1793
1827
|
return ff_compiler_Syntax.Argument(_c.at_, _c.name_, e2_)
|
|
1794
|
-
}))(a2_),
|
|
1828
|
+
}))(a2_)], _c.dictionaries_)
|
|
1795
1829
|
return
|
|
1796
1830
|
}
|
|
1797
1831
|
}
|
|
@@ -1802,11 +1836,11 @@ return
|
|
|
1802
1836
|
}
|
|
1803
1837
|
}
|
|
1804
1838
|
{
|
|
1805
|
-
if(_1.
|
|
1806
|
-
const a1_ = _1
|
|
1807
|
-
if(_1.
|
|
1808
|
-
const a2_ = _1
|
|
1809
|
-
if(_1.
|
|
1839
|
+
if(_1.length > 0) {
|
|
1840
|
+
const a1_ = _1[0];
|
|
1841
|
+
if(_1.length > 1) {
|
|
1842
|
+
const a2_ = _1[1];
|
|
1843
|
+
if(_1.length === 2) {
|
|
1810
1844
|
const _guard1 = ((((((operator_ === "+") || (operator_ === "-")) || (operator_ === "*")) || (operator_ === "/")) || (operator_ === "%")) || (operator_ === "^"));
|
|
1811
1845
|
if(_guard1) {
|
|
1812
1846
|
const t1_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
|
|
@@ -1819,7 +1853,7 @@ const _1 = ff_compiler_Unification.Unification_substitute(self_.unification_, t_
|
|
|
1819
1853
|
{
|
|
1820
1854
|
if(_1.TConstructor) {
|
|
1821
1855
|
const name_ = _1.name_;
|
|
1822
|
-
if(_1.generics_.
|
|
1856
|
+
if(_1.generics_.length === 0) {
|
|
1823
1857
|
const _guard1 = (name_ === ff_compiler_Inference.core_("Float"));
|
|
1824
1858
|
if(_guard1) {
|
|
1825
1859
|
return ff_core_Option.Some("Float")
|
|
@@ -1831,7 +1865,7 @@ return
|
|
|
1831
1865
|
{
|
|
1832
1866
|
if(_1.TConstructor) {
|
|
1833
1867
|
const name_ = _1.name_;
|
|
1834
|
-
if(_1.generics_.
|
|
1868
|
+
if(_1.generics_.length === 0) {
|
|
1835
1869
|
const _guard1 = (name_ === ff_compiler_Inference.core_("Int"));
|
|
1836
1870
|
if(_guard1) {
|
|
1837
1871
|
return ff_core_Option.Some("Int")
|
|
@@ -1843,7 +1877,7 @@ return
|
|
|
1843
1877
|
{
|
|
1844
1878
|
if(_1.TConstructor) {
|
|
1845
1879
|
const name_ = _1.name_;
|
|
1846
|
-
if(_1.generics_.
|
|
1880
|
+
if(_1.generics_.length === 0) {
|
|
1847
1881
|
const _guard1 = ((operator_ === "+") && (name_ === ff_compiler_Inference.core_("String")));
|
|
1848
1882
|
if(_guard1) {
|
|
1849
1883
|
return ff_core_Option.Some("String")
|
|
@@ -1861,7 +1895,7 @@ return
|
|
|
1861
1895
|
const chooseType_ = ((_1, _2) => {
|
|
1862
1896
|
{
|
|
1863
1897
|
if(_1.Some) {
|
|
1864
|
-
if(_1.value_
|
|
1898
|
+
if(_1.value_ === "String") {
|
|
1865
1899
|
if(_2.Some) {
|
|
1866
1900
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t1_)
|
|
1867
1901
|
return
|
|
@@ -1872,7 +1906,7 @@ return
|
|
|
1872
1906
|
{
|
|
1873
1907
|
if(_1.Some) {
|
|
1874
1908
|
if(_2.Some) {
|
|
1875
|
-
if(_2.value_
|
|
1909
|
+
if(_2.value_ === "String") {
|
|
1876
1910
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t2_)
|
|
1877
1911
|
return
|
|
1878
1912
|
}
|
|
@@ -1881,7 +1915,7 @@ return
|
|
|
1881
1915
|
}
|
|
1882
1916
|
{
|
|
1883
1917
|
if(_1.Some) {
|
|
1884
|
-
if(_1.value_
|
|
1918
|
+
if(_1.value_ === "Float") {
|
|
1885
1919
|
if(_2.Some) {
|
|
1886
1920
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t1_)
|
|
1887
1921
|
return
|
|
@@ -1892,7 +1926,7 @@ return
|
|
|
1892
1926
|
{
|
|
1893
1927
|
if(_1.Some) {
|
|
1894
1928
|
if(_2.Some) {
|
|
1895
|
-
if(_2.value_
|
|
1929
|
+
if(_2.value_ === "Float") {
|
|
1896
1930
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t2_)
|
|
1897
1931
|
return
|
|
1898
1932
|
}
|
|
@@ -1901,7 +1935,7 @@ return
|
|
|
1901
1935
|
}
|
|
1902
1936
|
{
|
|
1903
1937
|
if(_1.Some) {
|
|
1904
|
-
if(_1.value_
|
|
1938
|
+
if(_1.value_ === "Int") {
|
|
1905
1939
|
if(_2.Some) {
|
|
1906
1940
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t1_)
|
|
1907
1941
|
return
|
|
@@ -1912,7 +1946,7 @@ return
|
|
|
1912
1946
|
{
|
|
1913
1947
|
if(_1.Some) {
|
|
1914
1948
|
if(_2.Some) {
|
|
1915
|
-
if(_2.value_
|
|
1949
|
+
if(_2.value_ === "Int") {
|
|
1916
1950
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t2_)
|
|
1917
1951
|
return
|
|
1918
1952
|
}
|
|
@@ -1966,11 +2000,11 @@ chooseType_(magic_(t1_), magic_(t2_));
|
|
|
1966
2000
|
const _1 = e_;
|
|
1967
2001
|
{
|
|
1968
2002
|
const _c = _1;
|
|
1969
|
-
return ff_compiler_Syntax.ECall(_c.at_, target_, _c.effect_, _c.typeArguments_,
|
|
2003
|
+
return ff_compiler_Syntax.ECall(_c.at_, target_, _c.effect_, _c.typeArguments_, [(((_c) => {
|
|
1970
2004
|
return ff_compiler_Syntax.Argument(_c.at_, _c.name_, e1_)
|
|
1971
|
-
}))(a1_),
|
|
2005
|
+
}))(a1_), (((_c) => {
|
|
1972
2006
|
return ff_compiler_Syntax.Argument(_c.at_, _c.name_, e2_)
|
|
1973
|
-
}))(a2_),
|
|
2007
|
+
}))(a2_)], _c.dictionaries_)
|
|
1974
2008
|
return
|
|
1975
2009
|
}
|
|
1976
2010
|
}
|
|
@@ -2001,13 +2035,13 @@ return ff_core_Option.Option_isEmpty(_w1.default_)
|
|
|
2001
2035
|
return p_.name_
|
|
2002
2036
|
}));
|
|
2003
2037
|
const effect1_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, at_);
|
|
2004
|
-
const body_ = ff_compiler_Syntax.ECall(at_, ff_compiler_Syntax.DynamicCall(term_, false), effect1_,
|
|
2038
|
+
const body_ = ff_compiler_Syntax.ECall(at_, ff_compiler_Syntax.DynamicCall(term_, false), effect1_, [], ff_core_List.List_map(parameters_, ((x_) => {
|
|
2005
2039
|
return ff_compiler_Syntax.Argument(at_, ff_core_Option.Some(x_), ff_compiler_Syntax.EVariable(at_, x_))
|
|
2006
|
-
})),
|
|
2040
|
+
})), []);
|
|
2007
2041
|
const effect2_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, at_);
|
|
2008
|
-
const lambda_ = ff_compiler_Syntax.ELambda(at_, ff_compiler_Syntax.Lambda(at_, effect2_,
|
|
2042
|
+
const lambda_ = ff_compiler_Syntax.ELambda(at_, ff_compiler_Syntax.Lambda(at_, effect2_, [ff_compiler_Syntax.MatchCase(at_, ff_core_List.List_map(parameters_, ((_w1) => {
|
|
2009
2043
|
return ff_compiler_Syntax.PVariable(at_, ff_core_Option.Some(_w1))
|
|
2010
|
-
})),
|
|
2044
|
+
})), [], body_)]));
|
|
2011
2045
|
return ff_compiler_Inference.Inference_inferTerm(self_, (((_c) => {
|
|
2012
2046
|
return ff_compiler_Environment.Environment(_c.modulePrefix_, _c.symbols_, _c.traits_, _c.imports_, effect2_, _c.selfVariable_)
|
|
2013
2047
|
}))(environment_), expected_, lambda_)
|
|
@@ -2033,7 +2067,8 @@ return
|
|
|
2033
2067
|
}
|
|
2034
2068
|
}))
|
|
2035
2069
|
};
|
|
2036
|
-
let remainingArguments_ = arguments_;
|
|
2070
|
+
let remainingArguments_ = ff_core_List.List_toArray(arguments_);
|
|
2071
|
+
ff_core_Array.Array_reverse(remainingArguments_);
|
|
2037
2072
|
const newArguments_ = ff_core_List.List_map(parameters_, ((p_) => {
|
|
2038
2073
|
const t_ = p_.valueType_;
|
|
2039
2074
|
function defaultArgument_() {
|
|
@@ -2048,36 +2083,23 @@ return ff_compiler_Syntax.Argument(callAt_, ff_core_Option.Some(p_.name_), ff_co
|
|
|
2048
2083
|
}
|
|
2049
2084
|
}))
|
|
2050
2085
|
}
|
|
2051
|
-
{
|
|
2052
|
-
const _1 = remainingArguments_;
|
|
2053
|
-
{
|
|
2054
|
-
if(_1.Empty) {
|
|
2086
|
+
if(ff_core_Array.Array_isEmpty(remainingArguments_)) {
|
|
2055
2087
|
return defaultArgument_()
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
if(_1.head_.name_.None) {
|
|
2063
|
-
const e_ = _1.head_.value_;
|
|
2064
|
-
const remaining_ = _1.tail_;
|
|
2065
|
-
remainingArguments_ = remaining_;
|
|
2066
|
-
const e2_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, e_);
|
|
2067
|
-
return ff_compiler_Syntax.Argument(at_, ff_core_Option.Some(p_.name_), e2_)
|
|
2068
|
-
return
|
|
2069
|
-
}
|
|
2070
|
-
}
|
|
2071
|
-
}
|
|
2072
|
-
{
|
|
2073
|
-
return ff_core_Option.Option_else(ff_core_Option.Option_map(ff_core_List.List_find(remainingArguments_, ((_w1) => {
|
|
2088
|
+
} else if(ff_core_Option.Option_isEmpty(ff_core_Array.Array_grabLast(remainingArguments_).name_)) {
|
|
2089
|
+
const a_ = ff_core_Option.Option_grab(ff_core_Array.Array_pop(remainingArguments_));
|
|
2090
|
+
const e2_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, a_.value_);
|
|
2091
|
+
return ff_compiler_Syntax.Argument(a_.at_, ff_core_Option.Some(p_.name_), e2_)
|
|
2092
|
+
} else {
|
|
2093
|
+
return ff_core_Option.Option_else(ff_core_Option.Option_map(ff_core_Array.Array_find(remainingArguments_, ((_w1) => {
|
|
2074
2094
|
return ff_core_Option.Option_contains(_w1.name_, p_.name_, ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String)
|
|
2075
2095
|
})), ((_1) => {
|
|
2076
2096
|
{
|
|
2077
2097
|
const at_ = _1.at_;
|
|
2078
2098
|
const e_ = _1.value_;
|
|
2079
|
-
|
|
2080
|
-
return
|
|
2099
|
+
ff_core_Option.Option_each(ff_core_Array.Array_indexWhere(remainingArguments_, ((_w1) => {
|
|
2100
|
+
return ff_core_Option.Option_contains(_w1.name_, p_.name_, ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String)
|
|
2101
|
+
})), ((_w1) => {
|
|
2102
|
+
ff_core_Array.Array_delete(remainingArguments_, _w1, 1)
|
|
2081
2103
|
}));
|
|
2082
2104
|
const e2_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, e_);
|
|
2083
2105
|
return ff_compiler_Syntax.Argument(at_, ff_core_Option.Some(p_.name_), e2_)
|
|
@@ -2086,12 +2108,10 @@ return
|
|
|
2086
2108
|
})), (() => {
|
|
2087
2109
|
return defaultArgument_()
|
|
2088
2110
|
}))
|
|
2089
|
-
return
|
|
2090
|
-
}
|
|
2091
2111
|
}
|
|
2092
2112
|
}));
|
|
2093
2113
|
if((!ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_))) {
|
|
2094
|
-
ff_core_Option.Option_each(
|
|
2114
|
+
ff_core_Option.Option_each(ff_core_Array.Array_first(remainingArguments_), ((_1) => {
|
|
2095
2115
|
{
|
|
2096
2116
|
const callAt_ = _1.at_;
|
|
2097
2117
|
if(_1.name_.None) {
|
|
@@ -2110,7 +2130,7 @@ return
|
|
|
2110
2130
|
}));
|
|
2111
2131
|
return newArguments_
|
|
2112
2132
|
} else {
|
|
2113
|
-
return
|
|
2133
|
+
return [...newArguments_, ...ff_core_List.List_map(ff_core_Array.Array_drain(remainingArguments_), ((a_) => {
|
|
2114
2134
|
{
|
|
2115
2135
|
const _1 = a_;
|
|
2116
2136
|
{
|
|
@@ -2119,7 +2139,7 @@ return ff_compiler_Syntax.Argument(_c.at_, _c.name_, ff_compiler_Inference.Infer
|
|
|
2119
2139
|
return
|
|
2120
2140
|
}
|
|
2121
2141
|
}
|
|
2122
|
-
}))
|
|
2142
|
+
}))]
|
|
2123
2143
|
}
|
|
2124
2144
|
}
|
|
2125
2145
|
|
|
@@ -2127,7 +2147,7 @@ export function Inference_lookup(self_, environment_, expected_, at_, symbol_, t
|
|
|
2127
2147
|
return ff_core_Option.Option_elseIf(ff_compiler_Inference.Inference_lookupOption(self_, environment_, expected_, at_, symbol_, typeArguments_), (() => {
|
|
2128
2148
|
return ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)
|
|
2129
2149
|
}), (() => {
|
|
2130
|
-
const instantiated_ = ff_compiler_Environment.Instantiated(
|
|
2150
|
+
const instantiated_ = ff_compiler_Environment.Instantiated([], ff_compiler_Environment.Scheme(ff_core_Option.Option_isEmpty(arguments_), false, false, false, ff_compiler_Syntax.Signature(at_, symbol_, false, [], [], ff_core_List.List_map(ff_core_List.List_pairs(ff_core_List.List_flatten(ff_core_Option.Option_toList(arguments_))), ((_1) => {
|
|
2131
2151
|
{
|
|
2132
2152
|
const i_ = _1.first_;
|
|
2133
2153
|
const a_ = _1.second_;
|
|
@@ -2161,7 +2181,7 @@ const instantiation_ = ((!ff_core_List.List_isEmpty(typeArguments_))
|
|
|
2161
2181
|
const newTypeArguments_ = (((!scheme_.isVariable_) && ff_core_Option.Option_any(ff_core_List.List_first(scheme_.signature_.generics_), ((_w1) => {
|
|
2162
2182
|
return (_w1 === "Q$")
|
|
2163
2183
|
})))
|
|
2164
|
-
?
|
|
2184
|
+
? [ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, at_), ...typeArguments_]
|
|
2165
2185
|
: typeArguments_);
|
|
2166
2186
|
if(((ff_core_List.List_size(scheme_.signature_.generics_) !== ff_core_List.List_size(newTypeArguments_)) && (!ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)))) {
|
|
2167
2187
|
const extra_ = (ff_core_List.List_size(newTypeArguments_) - ff_core_List.List_size(typeArguments_));
|
|
@@ -2192,7 +2212,7 @@ return ff_compiler_Unification.Unification_instantiate(self_.unification_, insta
|
|
|
2192
2212
|
ff_compiler_Unification.Unification_constrain(self_.unification_, at_, ff_core_List.List_grabFirst(generics_), c_.name_, ff_core_List.List_dropFirst(generics_, 1))
|
|
2193
2213
|
}));
|
|
2194
2214
|
const signature_ = (((_c) => {
|
|
2195
|
-
return ff_compiler_Syntax.Signature(_c.at_, _c.name_, _c.member_,
|
|
2215
|
+
return ff_compiler_Syntax.Signature(_c.at_, _c.name_, _c.member_, [], [], parameters_, returnType_, effect_)
|
|
2196
2216
|
}))(scheme_.signature_);
|
|
2197
2217
|
const instantiated_ = ff_compiler_Environment.Instantiated(instantiation_, (((_c) => {
|
|
2198
2218
|
return ff_compiler_Environment.Scheme(_c.isVariable_, _c.isMutable_, _c.isNewtype_, _c.isTraitMethod_, signature_)
|
|
@@ -2352,7 +2372,7 @@ export async function Inference_inferExtendDefinition$(self_, environment_, defi
|
|
|
2352
2372
|
const selfParameter_ = ff_compiler_Syntax.Parameter(definition_.at_, false, definition_.name_, definition_.type_, ff_core_Option.None());
|
|
2353
2373
|
const functions_ = ff_core_List.List_map(definition_.methods_, ((method_) => {
|
|
2354
2374
|
const signature_ = (((_c) => {
|
|
2355
|
-
return ff_compiler_Syntax.Signature(_c.at_, _c.name_, _c.member_,
|
|
2375
|
+
return ff_compiler_Syntax.Signature(_c.at_, _c.name_, _c.member_, [...definition_.generics_, ...method_.signature_.generics_], [...definition_.constraints_, ...method_.signature_.constraints_], [selfParameter_, ...method_.signature_.parameters_], _c.returnType_, _c.effect_)
|
|
2356
2376
|
}))(method_.signature_);
|
|
2357
2377
|
const body_ = ff_compiler_Syntax.Target_mapFirefly(method_.body_, ((lambda_) => {
|
|
2358
2378
|
{
|
|
@@ -2364,7 +2384,7 @@ return ff_compiler_Syntax.Lambda(_c.at_, _c.effect_, ff_core_List.List_map(lambd
|
|
|
2364
2384
|
const _1 = case_;
|
|
2365
2385
|
{
|
|
2366
2386
|
const _c = _1;
|
|
2367
|
-
return ff_compiler_Syntax.MatchCase(_c.at_,
|
|
2387
|
+
return ff_compiler_Syntax.MatchCase(_c.at_, [ff_compiler_Syntax.PVariable(method_.at_, ff_core_Option.None()), ...case_.patterns_], _c.guards_, _c.body_)
|
|
2368
2388
|
return
|
|
2369
2389
|
}
|
|
2370
2390
|
}
|
|
@@ -2395,8 +2415,8 @@ if(ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, definition_.at_)) {
|
|
|
2395
2415
|
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferFunctionDefinitionHook(self_.unification_, environment_, definition_, self_.missing_))
|
|
2396
2416
|
};
|
|
2397
2417
|
const parameters_ = ff_core_List.List_map(definition_.signature_.parameters_, ((p_) => {
|
|
2398
|
-
const noEffect_ = ff_compiler_Syntax.TConstructor(p_.at_, "ff:core/Nothing.Nothing",
|
|
2399
|
-
const scheme_ = ff_compiler_Environment.Scheme(true, false, false, false, ff_compiler_Syntax.Signature(p_.at_, p_.name_, false,
|
|
2418
|
+
const noEffect_ = ff_compiler_Syntax.TConstructor(p_.at_, "ff:core/Nothing.Nothing", []);
|
|
2419
|
+
const scheme_ = ff_compiler_Environment.Scheme(true, false, false, false, ff_compiler_Syntax.Signature(p_.at_, p_.name_, false, [], [], [], p_.valueType_, noEffect_));
|
|
2400
2420
|
if(ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, p_.at_)) {
|
|
2401
2421
|
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferParameterHook(self_.unification_, environment_, p_, self_.missing_))
|
|
2402
2422
|
};
|
|
@@ -2409,7 +2429,7 @@ return ff_compiler_Environment.Environment(_c.modulePrefix_, ff_core_Map.Map_add
|
|
|
2409
2429
|
const parameterTypes_ = ff_core_List.List_map(parameters_, ((_w1) => {
|
|
2410
2430
|
return _w1.second_.signature_.returnType_
|
|
2411
2431
|
}));
|
|
2412
|
-
const functionType_ = ff_compiler_Syntax.TConstructor(definition_.at_, ("Function$" + ff_core_List.List_size(parameterTypes_)),
|
|
2432
|
+
const functionType_ = ff_compiler_Syntax.TConstructor(definition_.at_, ("Function$" + ff_core_List.List_size(parameterTypes_)), [definition_.signature_.effect_, ...parameterTypes_, definition_.signature_.returnType_]);
|
|
2413
2433
|
const instances_ = ff_compiler_Inference.constraintsToInstances_(definition_.signature_.constraints_);
|
|
2414
2434
|
return ff_compiler_Unification.Unification_withLocalInstances(self_.unification_, instances_, (() => {
|
|
2415
2435
|
{
|
|
@@ -2439,7 +2459,7 @@ const _1 = ff_core_List.List_grabLast(ts_);
|
|
|
2439
2459
|
{
|
|
2440
2460
|
if(_1.TConstructor) {
|
|
2441
2461
|
const n_ = _1.name_;
|
|
2442
|
-
if(_1.generics_.
|
|
2462
|
+
if(_1.generics_.length === 0) {
|
|
2443
2463
|
return (n_ === unitName_)
|
|
2444
2464
|
return
|
|
2445
2465
|
}
|
|
@@ -2466,7 +2486,7 @@ const cases_ = ((!returnsUnit_)
|
|
|
2466
2486
|
const _1 = c_;
|
|
2467
2487
|
{
|
|
2468
2488
|
const _c = _1;
|
|
2469
|
-
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_,
|
|
2489
|
+
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())))
|
|
2470
2490
|
return
|
|
2471
2491
|
}
|
|
2472
2492
|
}
|
|
@@ -2491,7 +2511,7 @@ const parameterTypes_ = ff_core_List.List_map(case_.patterns_, ((_w1) => {
|
|
|
2491
2511
|
return ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, _w1.at_)
|
|
2492
2512
|
}));
|
|
2493
2513
|
const returnType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, case_.at_);
|
|
2494
|
-
const functionType_ = ff_compiler_Syntax.TConstructor(case_.at_, ("Function$" + ff_core_List.List_size(case_.patterns_)),
|
|
2514
|
+
const functionType_ = ff_compiler_Syntax.TConstructor(case_.at_, ("Function$" + ff_core_List.List_size(case_.patterns_)), [environment_.effect_, ...parameterTypes_, returnType_]);
|
|
2495
2515
|
ff_compiler_Unification.Unification_unify(self_.unification_, case_.at_, expected_, functionType_);
|
|
2496
2516
|
const environment1_ = ff_core_List.List_foldLeft(ff_core_List.List_zip(parameterTypes_, case_.patterns_), environment_, ((_1, _2) => {
|
|
2497
2517
|
{
|
|
@@ -2503,8 +2523,8 @@ const symbols_ = ff_core_Map.Map_mapValues(ff_compiler_Inference.Inference_infer
|
|
|
2503
2523
|
const name_ = _1;
|
|
2504
2524
|
const at_ = _2.first_;
|
|
2505
2525
|
const type_ = _2.second_;
|
|
2506
|
-
const noEffect_ = ff_compiler_Syntax.TConstructor(at_, "ff:core/Nothing.Nothing",
|
|
2507
|
-
return ff_compiler_Environment.Scheme(true, false, false, false, ff_compiler_Syntax.Signature(at_, name_, false,
|
|
2526
|
+
const noEffect_ = ff_compiler_Syntax.TConstructor(at_, "ff:core/Nothing.Nothing", []);
|
|
2527
|
+
return ff_compiler_Environment.Scheme(true, false, false, false, ff_compiler_Syntax.Signature(at_, name_, false, [], [], [], type_, noEffect_))
|
|
2508
2528
|
return
|
|
2509
2529
|
}
|
|
2510
2530
|
}), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
|
|
@@ -2519,7 +2539,7 @@ return
|
|
|
2519
2539
|
return
|
|
2520
2540
|
}
|
|
2521
2541
|
}));
|
|
2522
|
-
|
|
2542
|
+
const guards_ = ff_core_List.List_toArray([]);
|
|
2523
2543
|
const environment3_ = ff_core_List.List_foldLeft(case_.guards_, environment1_, ((environment2_, g_) => {
|
|
2524
2544
|
const guardType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, g_.at_);
|
|
2525
2545
|
const guardTerm_ = ff_compiler_Inference.Inference_inferTerm(self_, environment2_, guardType_, g_.term_);
|
|
@@ -2528,14 +2548,14 @@ const symbols_ = ff_core_Map.Map_mapValues(ff_compiler_Inference.Inference_infer
|
|
|
2528
2548
|
const name_ = _1;
|
|
2529
2549
|
const at_ = _2.first_;
|
|
2530
2550
|
const type_ = _2.second_;
|
|
2531
|
-
const noEffect_ = ff_compiler_Syntax.TConstructor(at_, "ff:core/Nothing.Nothing",
|
|
2532
|
-
return ff_compiler_Environment.Scheme(true, false, false, false, ff_compiler_Syntax.Signature(at_, name_, false,
|
|
2551
|
+
const noEffect_ = ff_compiler_Syntax.TConstructor(at_, "ff:core/Nothing.Nothing", []);
|
|
2552
|
+
return ff_compiler_Environment.Scheme(true, false, false, false, ff_compiler_Syntax.Signature(at_, name_, false, [], [], [], type_, noEffect_))
|
|
2533
2553
|
return
|
|
2534
2554
|
}
|
|
2535
2555
|
}), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
|
|
2536
|
-
guards_
|
|
2556
|
+
ff_core_Array.Array_push(guards_, (((_c) => {
|
|
2537
2557
|
return ff_compiler_Syntax.MatchGuard(_c.at_, guardTerm_, _c.pattern_)
|
|
2538
|
-
}))(g_)
|
|
2558
|
+
}))(g_));
|
|
2539
2559
|
{
|
|
2540
2560
|
const _1 = environment2_;
|
|
2541
2561
|
{
|
|
@@ -2549,7 +2569,7 @@ return
|
|
|
2549
2569
|
const _1 = case_;
|
|
2550
2570
|
{
|
|
2551
2571
|
const _c = _1;
|
|
2552
|
-
return ff_compiler_Syntax.MatchCase(_c.at_, _c.patterns_,
|
|
2572
|
+
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_))
|
|
2553
2573
|
return
|
|
2554
2574
|
}
|
|
2555
2575
|
}
|
|
@@ -2582,7 +2602,7 @@ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferPatter
|
|
|
2582
2602
|
}
|
|
2583
2603
|
};
|
|
2584
2604
|
function literal_(coreTypeName_) {
|
|
2585
|
-
ff_compiler_Unification.Unification_unify(self_.unification_, pattern_.at_, expected_, ff_compiler_Syntax.TConstructor(pattern_.at_, ff_compiler_Inference.core_(coreTypeName_),
|
|
2605
|
+
ff_compiler_Unification.Unification_unify(self_.unification_, pattern_.at_, expected_, ff_compiler_Syntax.TConstructor(pattern_.at_, ff_compiler_Inference.core_(coreTypeName_), []));
|
|
2586
2606
|
return ff_core_Map.empty_()
|
|
2587
2607
|
}
|
|
2588
2608
|
{
|
|
@@ -2619,7 +2639,7 @@ if(_1.PVariable) {
|
|
|
2619
2639
|
const at_ = _1.at_;
|
|
2620
2640
|
if(_1.name_.Some) {
|
|
2621
2641
|
const name_ = _1.name_.value_;
|
|
2622
|
-
return ff_core_List.List_toMap(
|
|
2642
|
+
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)
|
|
2623
2643
|
return
|
|
2624
2644
|
}
|
|
2625
2645
|
}
|
|
@@ -2639,7 +2659,7 @@ const at_ = _1.at_;
|
|
|
2639
2659
|
const name_ = _1.name_;
|
|
2640
2660
|
const variableAt_ = _1.variableAt_;
|
|
2641
2661
|
const variableOption_ = _1.variable_;
|
|
2642
|
-
const instantiated_ = ff_core_Option.Option_else(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, at_, name_,
|
|
2662
|
+
const instantiated_ = ff_core_Option.Option_else(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, at_, name_, [], ff_core_Option.None()), (() => {
|
|
2643
2663
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ("No such variant: " + name_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
2644
2664
|
}));
|
|
2645
2665
|
if(instantiated_.scheme_.isNewtype_) {
|
|
@@ -2663,9 +2683,45 @@ return
|
|
|
2663
2683
|
{
|
|
2664
2684
|
if(_1.PVariant) {
|
|
2665
2685
|
const at_ = _1.at_;
|
|
2686
|
+
if(_1.name_ === "List$Empty") {
|
|
2687
|
+
if(_1.patterns_.length === 0) {
|
|
2688
|
+
const itemType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, at_);
|
|
2689
|
+
const listType_ = ff_compiler_Syntax.TConstructor(at_, ff_compiler_Inference.core_("List"), [itemType_]);
|
|
2690
|
+
ff_compiler_Unification.Unification_unify(self_.unification_, at_, expected_, listType_);
|
|
2691
|
+
return ff_core_List.List_toMap([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
|
|
2692
|
+
return
|
|
2693
|
+
}
|
|
2694
|
+
}
|
|
2695
|
+
}
|
|
2696
|
+
}
|
|
2697
|
+
{
|
|
2698
|
+
if(_1.PVariant) {
|
|
2699
|
+
const at_ = _1.at_;
|
|
2700
|
+
if(_1.name_ === "List$Link") {
|
|
2701
|
+
if(_1.patterns_.length > 0) {
|
|
2702
|
+
const head_ = _1.patterns_[0];
|
|
2703
|
+
if(_1.patterns_.length > 1) {
|
|
2704
|
+
const tail_ = _1.patterns_[1];
|
|
2705
|
+
if(_1.patterns_.length === 2) {
|
|
2706
|
+
const itemType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, at_);
|
|
2707
|
+
const listType_ = ff_compiler_Syntax.TConstructor(at_, ff_compiler_Inference.core_("List"), [itemType_]);
|
|
2708
|
+
ff_compiler_Unification.Unification_unify(self_.unification_, at_, expected_, listType_);
|
|
2709
|
+
const headVariables_ = ff_compiler_Inference.Inference_inferPattern(self_, environment_, itemType_, head_);
|
|
2710
|
+
const tailVariables_ = ff_compiler_Inference.Inference_inferPattern(self_, environment_, listType_, tail_);
|
|
2711
|
+
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
|
+
}
|
|
2717
|
+
}
|
|
2718
|
+
}
|
|
2719
|
+
{
|
|
2720
|
+
if(_1.PVariant) {
|
|
2721
|
+
const at_ = _1.at_;
|
|
2666
2722
|
const name_ = _1.name_;
|
|
2667
2723
|
const patterns_ = _1.patterns_;
|
|
2668
|
-
const instantiated_ = ff_core_Option.Option_else(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, at_, name_,
|
|
2724
|
+
const instantiated_ = ff_core_Option.Option_else(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, at_, name_, [], ff_core_Option.None()), (() => {
|
|
2669
2725
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ("No such variant: " + name_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
2670
2726
|
}));
|
|
2671
2727
|
ff_compiler_Unification.Unification_unify(self_.unification_, at_, expected_, instantiated_.scheme_.signature_.returnType_);
|
|
@@ -2697,7 +2753,7 @@ return box_
|
|
|
2697
2753
|
})()))
|
|
2698
2754
|
: ff_core_Option.None());
|
|
2699
2755
|
function literal_(coreTypeName_) {
|
|
2700
|
-
ff_compiler_Unification.Unification_unify(self_.unification_, term_.at_, expected_, ff_compiler_Syntax.TConstructor(term_.at_, ff_compiler_Inference.core_(coreTypeName_),
|
|
2756
|
+
ff_compiler_Unification.Unification_unify(self_.unification_, term_.at_, expected_, ff_compiler_Syntax.TConstructor(term_.at_, ff_compiler_Inference.core_(coreTypeName_), []));
|
|
2701
2757
|
return term_
|
|
2702
2758
|
}
|
|
2703
2759
|
{
|
|
@@ -2729,7 +2785,7 @@ return
|
|
|
2729
2785
|
{
|
|
2730
2786
|
if(_1.EVariable) {
|
|
2731
2787
|
const e_ = _1;
|
|
2732
|
-
return ff_core_Option.Option_else(ff_core_Option.Option_map(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, e_.name_,
|
|
2788
|
+
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_) => {
|
|
2733
2789
|
if(instantiated_.scheme_.isVariable_) {
|
|
2734
2790
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, instantiated_.scheme_.signature_.returnType_);
|
|
2735
2791
|
return term_
|
|
@@ -2766,7 +2822,7 @@ const symbolHook_ = ff_compiler_LspHook.SymbolHook(e_.field_, e_.at_, e_.at_);
|
|
|
2766
2822
|
const noEffect_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
|
|
2767
2823
|
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferRecordFieldHook(self_.unification_, environment_, expected_, t_, e_.field_))
|
|
2768
2824
|
};
|
|
2769
|
-
const fieldNames_ = ff_core_List.List_dropFirst(
|
|
2825
|
+
const fieldNames_ = ff_core_List.List_dropFirst(ff_core_String.String_split(name_, 36), 1);
|
|
2770
2826
|
return ff_core_Option.Option_else(ff_core_Option.Option_elseIf(ff_core_Option.Option_map(ff_core_Option.Option_map(ff_core_List.List_find(ff_core_List.List_pairs(fieldNames_), ((_w1) => {
|
|
2771
2827
|
return (_w1.second_ === e_.field_)
|
|
2772
2828
|
})), ((_w1) => {
|
|
@@ -2787,7 +2843,7 @@ return ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)
|
|
|
2787
2843
|
}), (() => {
|
|
2788
2844
|
return term_
|
|
2789
2845
|
})), (() => {
|
|
2790
|
-
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_,
|
|
2846
|
+
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)})
|
|
2791
2847
|
}))
|
|
2792
2848
|
return
|
|
2793
2849
|
}
|
|
@@ -2833,7 +2889,7 @@ return
|
|
|
2833
2889
|
}
|
|
2834
2890
|
{
|
|
2835
2891
|
if(_1.None) {
|
|
2836
|
-
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_,
|
|
2892
|
+
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)})
|
|
2837
2893
|
return
|
|
2838
2894
|
}
|
|
2839
2895
|
}
|
|
@@ -2864,7 +2920,7 @@ return
|
|
|
2864
2920
|
{
|
|
2865
2921
|
if(_1.EWildcard) {
|
|
2866
2922
|
const e_ = _1;
|
|
2867
|
-
return ff_core_Option.Option_grab(ff_core_Option.Option_map(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, ("_w" + e_.index_),
|
|
2923
|
+
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_) => {
|
|
2868
2924
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, instantiated_.scheme_.signature_.returnType_);
|
|
2869
2925
|
return term_
|
|
2870
2926
|
})))
|
|
@@ -2876,7 +2932,7 @@ if(_1.EList) {
|
|
|
2876
2932
|
const at_ = _1.at_;
|
|
2877
2933
|
const t_ = _1.elementType_;
|
|
2878
2934
|
const items_ = _1.items_;
|
|
2879
|
-
const listType_ = ff_compiler_Syntax.TConstructor(term_.at_, ff_compiler_Inference.core_("List"),
|
|
2935
|
+
const listType_ = ff_compiler_Syntax.TConstructor(term_.at_, ff_compiler_Inference.core_("List"), [t_]);
|
|
2880
2936
|
ff_compiler_Unification.Unification_unify(self_.unification_, at_, expected_, listType_);
|
|
2881
2937
|
return ff_compiler_Syntax.EList(at_, t_, ff_core_List.List_map(items_, ((_1) => {
|
|
2882
2938
|
{
|
|
@@ -2912,7 +2968,7 @@ const at2_ = _1.function_.at_;
|
|
|
2912
2968
|
const at3_ = _1.function_.lambda_.at_;
|
|
2913
2969
|
const effect3_ = _1.function_.lambda_.effect_;
|
|
2914
2970
|
const cases_ = _1.function_.lambda_.cases_;
|
|
2915
|
-
const e_ = ff_compiler_Syntax.EVariant(at_, "ff:core/Unit.Unit",
|
|
2971
|
+
const e_ = ff_compiler_Syntax.EVariant(at_, "ff:core/Unit.Unit", [], ff_core_Option.None());
|
|
2916
2972
|
const newCases_ = ff_core_List.List_map(cases_, ((case_) => {
|
|
2917
2973
|
{
|
|
2918
2974
|
const _1 = case_;
|
|
@@ -2929,8 +2985,8 @@ const _1 = after_;
|
|
|
2929
2985
|
{
|
|
2930
2986
|
if(_1.EVariant) {
|
|
2931
2987
|
const at_ = _1.at_;
|
|
2932
|
-
if(_1.name_
|
|
2933
|
-
const unitType_ = ff_compiler_Syntax.TConstructor(at_, ff_compiler_Inference.core_("Unit"),
|
|
2988
|
+
if(_1.name_ === "ff:core/Unit.Unit") {
|
|
2989
|
+
const unitType_ = ff_compiler_Syntax.TConstructor(at_, ff_compiler_Inference.core_("Unit"), []);
|
|
2934
2990
|
ff_compiler_Unification.Unification_unify(self_.unification_, at_, expected_, unitType_);
|
|
2935
2991
|
return ff_compiler_Inference.Inference_inferTerm(self_, environment_, newExpected_, newPipe_)
|
|
2936
2992
|
return
|
|
@@ -2957,8 +3013,8 @@ return
|
|
|
2957
3013
|
{
|
|
2958
3014
|
if(_1.ELet) {
|
|
2959
3015
|
const e_ = _1;
|
|
2960
|
-
const noEffect_ = ff_compiler_Syntax.TConstructor(e_.at_, "ff:core/Nothing.Nothing",
|
|
2961
|
-
const scheme_ = ff_compiler_Environment.Scheme(true, e_.mutable_, false, false, ff_compiler_Syntax.Signature(e_.at_, e_.name_, false,
|
|
3016
|
+
const noEffect_ = ff_compiler_Syntax.TConstructor(e_.at_, "ff:core/Nothing.Nothing", []);
|
|
3017
|
+
const scheme_ = ff_compiler_Environment.Scheme(true, e_.mutable_, false, false, ff_compiler_Syntax.Signature(e_.at_, e_.name_, false, [], [], [], e_.valueType_, noEffect_));
|
|
2962
3018
|
const environment2_ = (((_c) => {
|
|
2963
3019
|
return ff_compiler_Environment.Environment(_c.modulePrefix_, ff_core_Map.Map_add(environment_.symbols_, e_.name_, scheme_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), _c.traits_, _c.imports_, _c.effect_, _c.selfVariable_)
|
|
2964
3020
|
}))(environment_);
|
|
@@ -2980,13 +3036,13 @@ const l_ = _1.lambda_;
|
|
|
2980
3036
|
do {
|
|
2981
3037
|
const _1 = l_.cases_;
|
|
2982
3038
|
{
|
|
2983
|
-
if(_1.
|
|
2984
|
-
if(_1.
|
|
2985
|
-
if(_1.
|
|
2986
|
-
if(_1.
|
|
2987
|
-
const insideAt_ = _1.
|
|
2988
|
-
if(_1.
|
|
2989
|
-
if(_1.
|
|
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) {
|
|
3043
|
+
const insideAt_ = _1[0].body_.at_;
|
|
3044
|
+
if(_1[0].body_.name_ === "") {
|
|
3045
|
+
if(_1.length === 1) {
|
|
2990
3046
|
const _guard1 = ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, insideAt_);
|
|
2991
3047
|
if(_guard1) {
|
|
2992
3048
|
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferLambdaStartHook(self_.unification_, environment_, expected_))
|
|
@@ -3000,16 +3056,16 @@ break
|
|
|
3000
3056
|
}
|
|
3001
3057
|
}
|
|
3002
3058
|
{
|
|
3003
|
-
if(_1.
|
|
3004
|
-
if(_1.
|
|
3005
|
-
if(_1.
|
|
3006
|
-
if(_1.
|
|
3007
|
-
if(_1.
|
|
3008
|
-
const insideAt_ = _1.
|
|
3009
|
-
if(_1.
|
|
3010
|
-
if(_1.
|
|
3011
|
-
if(_1.
|
|
3012
|
-
if(_1.
|
|
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) {
|
|
3064
|
+
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) {
|
|
3013
3069
|
const _guard1 = ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, insideAt_);
|
|
3014
3070
|
if(_guard1) {
|
|
3015
3071
|
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferLambdaStartHook(self_.unification_, environment_, expected_))
|
|
@@ -3072,7 +3128,7 @@ return _w1.name_
|
|
|
3072
3128
|
})), "$")), ff_core_List.List_map(parameters_, ((_w1) => {
|
|
3073
3129
|
return _w1.valueType_
|
|
3074
3130
|
})));
|
|
3075
|
-
const functionType_ = ff_compiler_Syntax.TConstructor(e_.at_, "Function$1",
|
|
3131
|
+
const functionType_ = ff_compiler_Syntax.TConstructor(e_.at_, "Function$1", [ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_), instantiated_.scheme_.signature_.returnType_, ff_compiler_Syntax.TConstructor(e_.at_, ff_compiler_Inference.core_("Option"), [recordType_])]);
|
|
3076
3132
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, functionType_);
|
|
3077
3133
|
{
|
|
3078
3134
|
const _1 = e_;
|
|
@@ -3090,7 +3146,7 @@ return
|
|
|
3090
3146
|
{
|
|
3091
3147
|
if(_1.ECopy) {
|
|
3092
3148
|
const e_ = _1;
|
|
3093
|
-
const scheme_ = ff_core_Option.Option_else(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, e_.name_,
|
|
3149
|
+
const scheme_ = ff_core_Option.Option_else(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, e_.name_, [], ff_core_Option.None()), (() => {
|
|
3094
3150
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(e_.at_, ("Symbol not in scope: " + e_.name_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
3095
3151
|
})).scheme_;
|
|
3096
3152
|
if(scheme_.isNewtype_) {
|
|
@@ -3157,9 +3213,9 @@ return ff_compiler_Syntax.Location((e_.at_.file_ + "/<copy>"), _c.line_, _c.colu
|
|
|
3157
3213
|
return ff_compiler_Syntax.Argument(at_, ff_core_Option.Some(name_), ff_compiler_Syntax.EField(at_, false, ff_compiler_Syntax.EVariable(at_, "_c"), name_))
|
|
3158
3214
|
}))
|
|
3159
3215
|
}));
|
|
3160
|
-
const body_ = ff_compiler_Syntax.EVariant(e_.at_, e_.name_,
|
|
3216
|
+
const body_ = ff_compiler_Syntax.EVariant(e_.at_, e_.name_, [], ff_core_Option.Some(arguments_));
|
|
3161
3217
|
const effect_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
|
|
3162
|
-
const e1_ = ff_compiler_Syntax.EPipe(e_.at_, e_.record_, effect_, ff_compiler_Syntax.ELambda(e_.at_, ff_compiler_Syntax.Lambda(e_.at_, effect_,
|
|
3218
|
+
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_)])));
|
|
3163
3219
|
return ff_compiler_Inference.Inference_inferTerm(self_, environment_, expected_, e1_)
|
|
3164
3220
|
return
|
|
3165
3221
|
}
|
|
@@ -3168,7 +3224,7 @@ return
|
|
|
3168
3224
|
if(_1.EPipe) {
|
|
3169
3225
|
const e_ = _1;
|
|
3170
3226
|
const valueType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
|
|
3171
|
-
const functionType_ = ff_compiler_Syntax.TConstructor(e_.at_, "Function$1",
|
|
3227
|
+
const functionType_ = ff_compiler_Syntax.TConstructor(e_.at_, "Function$1", [e_.effect_, valueType_, expected_]);
|
|
3172
3228
|
const value_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, valueType_, e_.value_);
|
|
3173
3229
|
const function_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, functionType_, e_.function_);
|
|
3174
3230
|
ff_compiler_Unification.Unification_affect(self_.unification_, term_.at_, e_.effect_, environment_.effect_);
|
|
@@ -3275,9 +3331,9 @@ const t_ = _1;
|
|
|
3275
3331
|
if(_1.TConstructor) {
|
|
3276
3332
|
const name_ = _1.name_;
|
|
3277
3333
|
const methodName_ = ((name_ + "_") + f_.field_);
|
|
3278
|
-
const arguments_ =
|
|
3334
|
+
const arguments_ = [ff_compiler_Syntax.Argument(f_.record_.at_, ff_core_Option.None(), f_.record_), ...e_.arguments_];
|
|
3279
3335
|
{
|
|
3280
|
-
const _1 = ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, f_.at_, methodName_,
|
|
3336
|
+
const _1 = ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, f_.at_, methodName_, [], ff_core_Option.Some(arguments_));
|
|
3281
3337
|
{
|
|
3282
3338
|
if(_1.Some) {
|
|
3283
3339
|
const instantiated_ = _1.value_;
|
|
@@ -3297,7 +3353,7 @@ return
|
|
|
3297
3353
|
}
|
|
3298
3354
|
{
|
|
3299
3355
|
if(_1.None) {
|
|
3300
|
-
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_,
|
|
3356
|
+
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)})
|
|
3301
3357
|
return
|
|
3302
3358
|
}
|
|
3303
3359
|
}
|
|
@@ -3396,7 +3452,7 @@ return
|
|
|
3396
3452
|
{
|
|
3397
3453
|
if(_1.EAssign) {
|
|
3398
3454
|
const e_ = _1;
|
|
3399
|
-
return ff_core_Option.Option_else(ff_core_Option.Option_map(ff_compiler_Inference.Inference_lookup(self_, environment_, expected_, e_.at_, e_.variable_,
|
|
3455
|
+
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_) => {
|
|
3400
3456
|
if((instantiated_.scheme_.isMutable_ || ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_))) {
|
|
3401
3457
|
const value_ = ff_compiler_Inference.Inference_inferAssignment(self_, environment_, expected_, e_.at_, e_.operator_, e_.value_, instantiated_.scheme_.signature_);
|
|
3402
3458
|
{
|
|
@@ -3464,13 +3520,13 @@ return
|
|
|
3464
3520
|
{
|
|
3465
3521
|
if(_1.Some) {
|
|
3466
3522
|
const instantiated_ = _1.value_;
|
|
3467
|
-
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_,
|
|
3523
|
+
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)})
|
|
3468
3524
|
return
|
|
3469
3525
|
}
|
|
3470
3526
|
}
|
|
3471
3527
|
{
|
|
3472
3528
|
if(_1.None) {
|
|
3473
|
-
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_,
|
|
3529
|
+
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)})
|
|
3474
3530
|
return
|
|
3475
3531
|
}
|
|
3476
3532
|
}
|
|
@@ -3504,12 +3560,12 @@ return
|
|
|
3504
3560
|
export async function Inference_inferAssignment$(self_, environment_, expected_, at_, operator_, value_, signature_, $task) {
|
|
3505
3561
|
const t_ = signature_.returnType_;
|
|
3506
3562
|
if(((operator_ === "+") || (operator_ === "-"))) {
|
|
3507
|
-
ff_compiler_Unification.Unification_unify(self_.unification_, at_, t_, ff_compiler_Syntax.TConstructor(at_, ff_compiler_Inference.core_("Int"),
|
|
3563
|
+
ff_compiler_Unification.Unification_unify(self_.unification_, at_, t_, ff_compiler_Syntax.TConstructor(at_, ff_compiler_Inference.core_("Int"), []))
|
|
3508
3564
|
} else if((operator_ !== "")) {
|
|
3509
3565
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, (("Only +=, -= and = assignments are supported. Got: " + operator_) + "=")), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
3510
3566
|
} else {};
|
|
3511
3567
|
const newValue_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, value_);
|
|
3512
|
-
ff_compiler_Unification.Unification_unify(self_.unification_, at_, expected_, ff_compiler_Syntax.TConstructor(at_, ff_compiler_Inference.core_("Unit"),
|
|
3568
|
+
ff_compiler_Unification.Unification_unify(self_.unification_, at_, expected_, ff_compiler_Syntax.TConstructor(at_, ff_compiler_Inference.core_("Unit"), []));
|
|
3513
3569
|
return newValue_
|
|
3514
3570
|
}
|
|
3515
3571
|
|
|
@@ -3554,7 +3610,7 @@ const _1 = e_;
|
|
|
3554
3610
|
const _c = _1;
|
|
3555
3611
|
return ff_compiler_Syntax.ECall(_c.at_, ff_compiler_Syntax.StaticCall(name_, call_.tailCall_, false), signature_.effect_, ff_core_List.List_map(instantiation_, ((_w1) => {
|
|
3556
3612
|
return _w1.second_
|
|
3557
|
-
})),
|
|
3613
|
+
})), [selfArgument_, ...arguments_], _c.dictionaries_)
|
|
3558
3614
|
return
|
|
3559
3615
|
}
|
|
3560
3616
|
}
|
|
@@ -3646,7 +3702,7 @@ const effect_ = ff_compiler_Unification.Unification_freshUnificationVariable(sel
|
|
|
3646
3702
|
const argumentTypes_ = ff_core_List.List_map(e_.arguments_, ((_w1) => {
|
|
3647
3703
|
return ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, _w1.at_)
|
|
3648
3704
|
}));
|
|
3649
|
-
const functionType_ = ff_compiler_Syntax.TConstructor(e_.at_, ("Function$" + ff_core_List.List_size(e_.arguments_)),
|
|
3705
|
+
const functionType_ = ff_compiler_Syntax.TConstructor(e_.at_, ("Function$" + ff_core_List.List_size(e_.arguments_)), [effect_, ...argumentTypes_, expected_]);
|
|
3650
3706
|
const function_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, functionType_, call_.function_);
|
|
3651
3707
|
const arguments_ = ff_core_List.List_map(ff_core_List.List_zip(e_.arguments_, argumentTypes_), ((_1) => {
|
|
3652
3708
|
{
|
|
@@ -3676,7 +3732,7 @@ const _1 = e_;
|
|
|
3676
3732
|
const _c = _1;
|
|
3677
3733
|
return ff_compiler_Syntax.ECall(_c.at_, (((_c) => {
|
|
3678
3734
|
return ff_compiler_Syntax.DynamicCall(function_, _c.tailCall_)
|
|
3679
|
-
}))(call_), effect_,
|
|
3735
|
+
}))(call_), effect_, [], arguments_, _c.dictionaries_)
|
|
3680
3736
|
return
|
|
3681
3737
|
}
|
|
3682
3738
|
}
|
|
@@ -3700,21 +3756,21 @@ const target_ = ff_compiler_Syntax.StaticCall(operator_, false, false);
|
|
|
3700
3756
|
{
|
|
3701
3757
|
const _1 = e_.arguments_;
|
|
3702
3758
|
{
|
|
3703
|
-
if(_1.
|
|
3704
|
-
const a1_ = _1
|
|
3705
|
-
if(_1.
|
|
3759
|
+
if(_1.length > 0) {
|
|
3760
|
+
const a1_ = _1[0];
|
|
3761
|
+
if(_1.length === 1) {
|
|
3706
3762
|
const _guard1 = (operator_ === "!");
|
|
3707
3763
|
if(_guard1) {
|
|
3708
|
-
const t_ = ff_compiler_Syntax.TConstructor(e_.at_, ff_compiler_Inference.core_("Bool"),
|
|
3764
|
+
const t_ = ff_compiler_Syntax.TConstructor(e_.at_, ff_compiler_Inference.core_("Bool"), []);
|
|
3709
3765
|
const e1_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, a1_.value_);
|
|
3710
3766
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t_);
|
|
3711
3767
|
{
|
|
3712
3768
|
const _1 = e_;
|
|
3713
3769
|
{
|
|
3714
3770
|
const _c = _1;
|
|
3715
|
-
return ff_compiler_Syntax.ECall(_c.at_, target_, _c.effect_, _c.typeArguments_,
|
|
3771
|
+
return ff_compiler_Syntax.ECall(_c.at_, target_, _c.effect_, _c.typeArguments_, [(((_c) => {
|
|
3716
3772
|
return ff_compiler_Syntax.Argument(_c.at_, _c.name_, e1_)
|
|
3717
|
-
}))(a1_),
|
|
3773
|
+
}))(a1_)], _c.dictionaries_)
|
|
3718
3774
|
return
|
|
3719
3775
|
}
|
|
3720
3776
|
}
|
|
@@ -3724,9 +3780,9 @@ return
|
|
|
3724
3780
|
}
|
|
3725
3781
|
}
|
|
3726
3782
|
{
|
|
3727
|
-
if(_1.
|
|
3728
|
-
const a1_ = _1
|
|
3729
|
-
if(_1.
|
|
3783
|
+
if(_1.length > 0) {
|
|
3784
|
+
const a1_ = _1[0];
|
|
3785
|
+
if(_1.length === 1) {
|
|
3730
3786
|
const _guard1 = (operator_ === "-");
|
|
3731
3787
|
if(_guard1) {
|
|
3732
3788
|
const t1_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
|
|
@@ -3736,7 +3792,7 @@ const _1 = ff_compiler_Unification.Unification_substitute(self_.unification_, t1
|
|
|
3736
3792
|
{
|
|
3737
3793
|
if(_1.TConstructor) {
|
|
3738
3794
|
const name_ = _1.name_;
|
|
3739
|
-
if(_1.generics_.
|
|
3795
|
+
if(_1.generics_.length === 0) {
|
|
3740
3796
|
const _guard1 = (name_ === ff_compiler_Inference.core_("Float"));
|
|
3741
3797
|
if(_guard1) {
|
|
3742
3798
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t1_)
|
|
@@ -3748,7 +3804,7 @@ break
|
|
|
3748
3804
|
{
|
|
3749
3805
|
if(_1.TConstructor) {
|
|
3750
3806
|
const name_ = _1.name_;
|
|
3751
|
-
if(_1.generics_.
|
|
3807
|
+
if(_1.generics_.length === 0) {
|
|
3752
3808
|
const _guard1 = (name_ === ff_compiler_Inference.core_("Int"));
|
|
3753
3809
|
if(_guard1) {
|
|
3754
3810
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t1_)
|
|
@@ -3773,9 +3829,9 @@ break
|
|
|
3773
3829
|
const _1 = e_;
|
|
3774
3830
|
{
|
|
3775
3831
|
const _c = _1;
|
|
3776
|
-
return ff_compiler_Syntax.ECall(_c.at_, target_, _c.effect_, _c.typeArguments_,
|
|
3832
|
+
return ff_compiler_Syntax.ECall(_c.at_, target_, _c.effect_, _c.typeArguments_, [(((_c) => {
|
|
3777
3833
|
return ff_compiler_Syntax.Argument(_c.at_, _c.name_, e1_)
|
|
3778
|
-
}))(a1_),
|
|
3834
|
+
}))(a1_)], _c.dictionaries_)
|
|
3779
3835
|
return
|
|
3780
3836
|
}
|
|
3781
3837
|
}
|
|
@@ -3785,14 +3841,14 @@ return
|
|
|
3785
3841
|
}
|
|
3786
3842
|
}
|
|
3787
3843
|
{
|
|
3788
|
-
if(_1.
|
|
3789
|
-
const a1_ = _1
|
|
3790
|
-
if(_1.
|
|
3791
|
-
const a2_ = _1
|
|
3792
|
-
if(_1.
|
|
3844
|
+
if(_1.length > 0) {
|
|
3845
|
+
const a1_ = _1[0];
|
|
3846
|
+
if(_1.length > 1) {
|
|
3847
|
+
const a2_ = _1[1];
|
|
3848
|
+
if(_1.length === 2) {
|
|
3793
3849
|
const _guard1 = ((operator_ === "||") || (operator_ === "&&"));
|
|
3794
3850
|
if(_guard1) {
|
|
3795
|
-
const t_ = ff_compiler_Syntax.TConstructor(e_.at_, ff_compiler_Inference.core_("Bool"),
|
|
3851
|
+
const t_ = ff_compiler_Syntax.TConstructor(e_.at_, ff_compiler_Inference.core_("Bool"), []);
|
|
3796
3852
|
const e1_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, a1_.value_);
|
|
3797
3853
|
const e2_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, a2_.value_);
|
|
3798
3854
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t_);
|
|
@@ -3800,11 +3856,11 @@ ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_,
|
|
|
3800
3856
|
const _1 = e_;
|
|
3801
3857
|
{
|
|
3802
3858
|
const _c = _1;
|
|
3803
|
-
return ff_compiler_Syntax.ECall(_c.at_, target_, _c.effect_, _c.typeArguments_,
|
|
3859
|
+
return ff_compiler_Syntax.ECall(_c.at_, target_, _c.effect_, _c.typeArguments_, [(((_c) => {
|
|
3804
3860
|
return ff_compiler_Syntax.Argument(_c.at_, _c.name_, e1_)
|
|
3805
|
-
}))(a1_),
|
|
3861
|
+
}))(a1_), (((_c) => {
|
|
3806
3862
|
return ff_compiler_Syntax.Argument(_c.at_, _c.name_, e2_)
|
|
3807
|
-
}))(a2_),
|
|
3863
|
+
}))(a2_)], _c.dictionaries_)
|
|
3808
3864
|
return
|
|
3809
3865
|
}
|
|
3810
3866
|
}
|
|
@@ -3815,26 +3871,26 @@ return
|
|
|
3815
3871
|
}
|
|
3816
3872
|
}
|
|
3817
3873
|
{
|
|
3818
|
-
if(_1.
|
|
3819
|
-
const a1_ = _1
|
|
3820
|
-
if(_1.
|
|
3821
|
-
const a2_ = _1
|
|
3822
|
-
if(_1.
|
|
3874
|
+
if(_1.length > 0) {
|
|
3875
|
+
const a1_ = _1[0];
|
|
3876
|
+
if(_1.length > 1) {
|
|
3877
|
+
const a2_ = _1[1];
|
|
3878
|
+
if(_1.length === 2) {
|
|
3823
3879
|
const _guard1 = ((operator_ === "===") || (operator_ === "!=="));
|
|
3824
3880
|
if(_guard1) {
|
|
3825
3881
|
const t1_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
|
|
3826
3882
|
const e1_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t1_, a1_.value_);
|
|
3827
3883
|
const e2_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t1_, a2_.value_);
|
|
3828
|
-
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, ff_compiler_Syntax.TConstructor(e_.at_, ff_compiler_Inference.core_("Bool"),
|
|
3884
|
+
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, ff_compiler_Syntax.TConstructor(e_.at_, ff_compiler_Inference.core_("Bool"), []));
|
|
3829
3885
|
{
|
|
3830
3886
|
const _1 = e_;
|
|
3831
3887
|
{
|
|
3832
3888
|
const _c = _1;
|
|
3833
|
-
return ff_compiler_Syntax.ECall(_c.at_, target_, _c.effect_, _c.typeArguments_,
|
|
3889
|
+
return ff_compiler_Syntax.ECall(_c.at_, target_, _c.effect_, _c.typeArguments_, [(((_c) => {
|
|
3834
3890
|
return ff_compiler_Syntax.Argument(_c.at_, _c.name_, e1_)
|
|
3835
|
-
}))(a1_),
|
|
3891
|
+
}))(a1_), (((_c) => {
|
|
3836
3892
|
return ff_compiler_Syntax.Argument(_c.at_, _c.name_, e2_)
|
|
3837
|
-
}))(a2_),
|
|
3893
|
+
}))(a2_)], _c.dictionaries_)
|
|
3838
3894
|
return
|
|
3839
3895
|
}
|
|
3840
3896
|
}
|
|
@@ -3845,11 +3901,11 @@ return
|
|
|
3845
3901
|
}
|
|
3846
3902
|
}
|
|
3847
3903
|
{
|
|
3848
|
-
if(_1.
|
|
3849
|
-
const a1_ = _1
|
|
3850
|
-
if(_1.
|
|
3851
|
-
const a2_ = _1
|
|
3852
|
-
if(_1.
|
|
3904
|
+
if(_1.length > 0) {
|
|
3905
|
+
const a1_ = _1[0];
|
|
3906
|
+
if(_1.length > 1) {
|
|
3907
|
+
const a2_ = _1[1];
|
|
3908
|
+
if(_1.length === 2) {
|
|
3853
3909
|
const _guard1 = ((((((operator_ === "+") || (operator_ === "-")) || (operator_ === "*")) || (operator_ === "/")) || (operator_ === "%")) || (operator_ === "^"));
|
|
3854
3910
|
if(_guard1) {
|
|
3855
3911
|
const t1_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
|
|
@@ -3862,7 +3918,7 @@ const _1 = ff_compiler_Unification.Unification_substitute(self_.unification_, t_
|
|
|
3862
3918
|
{
|
|
3863
3919
|
if(_1.TConstructor) {
|
|
3864
3920
|
const name_ = _1.name_;
|
|
3865
|
-
if(_1.generics_.
|
|
3921
|
+
if(_1.generics_.length === 0) {
|
|
3866
3922
|
const _guard1 = (name_ === ff_compiler_Inference.core_("Float"));
|
|
3867
3923
|
if(_guard1) {
|
|
3868
3924
|
return ff_core_Option.Some("Float")
|
|
@@ -3874,7 +3930,7 @@ return
|
|
|
3874
3930
|
{
|
|
3875
3931
|
if(_1.TConstructor) {
|
|
3876
3932
|
const name_ = _1.name_;
|
|
3877
|
-
if(_1.generics_.
|
|
3933
|
+
if(_1.generics_.length === 0) {
|
|
3878
3934
|
const _guard1 = (name_ === ff_compiler_Inference.core_("Int"));
|
|
3879
3935
|
if(_guard1) {
|
|
3880
3936
|
return ff_core_Option.Some("Int")
|
|
@@ -3886,7 +3942,7 @@ return
|
|
|
3886
3942
|
{
|
|
3887
3943
|
if(_1.TConstructor) {
|
|
3888
3944
|
const name_ = _1.name_;
|
|
3889
|
-
if(_1.generics_.
|
|
3945
|
+
if(_1.generics_.length === 0) {
|
|
3890
3946
|
const _guard1 = ((operator_ === "+") && (name_ === ff_compiler_Inference.core_("String")));
|
|
3891
3947
|
if(_guard1) {
|
|
3892
3948
|
return ff_core_Option.Some("String")
|
|
@@ -3904,7 +3960,7 @@ return
|
|
|
3904
3960
|
const chooseType_ = ((_1, _2) => {
|
|
3905
3961
|
{
|
|
3906
3962
|
if(_1.Some) {
|
|
3907
|
-
if(_1.value_
|
|
3963
|
+
if(_1.value_ === "String") {
|
|
3908
3964
|
if(_2.Some) {
|
|
3909
3965
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t1_)
|
|
3910
3966
|
return
|
|
@@ -3915,7 +3971,7 @@ return
|
|
|
3915
3971
|
{
|
|
3916
3972
|
if(_1.Some) {
|
|
3917
3973
|
if(_2.Some) {
|
|
3918
|
-
if(_2.value_
|
|
3974
|
+
if(_2.value_ === "String") {
|
|
3919
3975
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t2_)
|
|
3920
3976
|
return
|
|
3921
3977
|
}
|
|
@@ -3924,7 +3980,7 @@ return
|
|
|
3924
3980
|
}
|
|
3925
3981
|
{
|
|
3926
3982
|
if(_1.Some) {
|
|
3927
|
-
if(_1.value_
|
|
3983
|
+
if(_1.value_ === "Float") {
|
|
3928
3984
|
if(_2.Some) {
|
|
3929
3985
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t1_)
|
|
3930
3986
|
return
|
|
@@ -3935,7 +3991,7 @@ return
|
|
|
3935
3991
|
{
|
|
3936
3992
|
if(_1.Some) {
|
|
3937
3993
|
if(_2.Some) {
|
|
3938
|
-
if(_2.value_
|
|
3994
|
+
if(_2.value_ === "Float") {
|
|
3939
3995
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t2_)
|
|
3940
3996
|
return
|
|
3941
3997
|
}
|
|
@@ -3944,7 +4000,7 @@ return
|
|
|
3944
4000
|
}
|
|
3945
4001
|
{
|
|
3946
4002
|
if(_1.Some) {
|
|
3947
|
-
if(_1.value_
|
|
4003
|
+
if(_1.value_ === "Int") {
|
|
3948
4004
|
if(_2.Some) {
|
|
3949
4005
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t1_)
|
|
3950
4006
|
return
|
|
@@ -3955,7 +4011,7 @@ return
|
|
|
3955
4011
|
{
|
|
3956
4012
|
if(_1.Some) {
|
|
3957
4013
|
if(_2.Some) {
|
|
3958
|
-
if(_2.value_
|
|
4014
|
+
if(_2.value_ === "Int") {
|
|
3959
4015
|
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, expected_, t2_)
|
|
3960
4016
|
return
|
|
3961
4017
|
}
|
|
@@ -4009,11 +4065,11 @@ chooseType_(magic_(t1_), magic_(t2_));
|
|
|
4009
4065
|
const _1 = e_;
|
|
4010
4066
|
{
|
|
4011
4067
|
const _c = _1;
|
|
4012
|
-
return ff_compiler_Syntax.ECall(_c.at_, target_, _c.effect_, _c.typeArguments_,
|
|
4068
|
+
return ff_compiler_Syntax.ECall(_c.at_, target_, _c.effect_, _c.typeArguments_, [(((_c) => {
|
|
4013
4069
|
return ff_compiler_Syntax.Argument(_c.at_, _c.name_, e1_)
|
|
4014
|
-
}))(a1_),
|
|
4070
|
+
}))(a1_), (((_c) => {
|
|
4015
4071
|
return ff_compiler_Syntax.Argument(_c.at_, _c.name_, e2_)
|
|
4016
|
-
}))(a2_),
|
|
4072
|
+
}))(a2_)], _c.dictionaries_)
|
|
4017
4073
|
return
|
|
4018
4074
|
}
|
|
4019
4075
|
}
|
|
@@ -4044,13 +4100,13 @@ return ff_core_Option.Option_isEmpty(_w1.default_)
|
|
|
4044
4100
|
return p_.name_
|
|
4045
4101
|
}));
|
|
4046
4102
|
const effect1_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, at_);
|
|
4047
|
-
const body_ = ff_compiler_Syntax.ECall(at_, ff_compiler_Syntax.DynamicCall(term_, false), effect1_,
|
|
4103
|
+
const body_ = ff_compiler_Syntax.ECall(at_, ff_compiler_Syntax.DynamicCall(term_, false), effect1_, [], ff_core_List.List_map(parameters_, ((x_) => {
|
|
4048
4104
|
return ff_compiler_Syntax.Argument(at_, ff_core_Option.Some(x_), ff_compiler_Syntax.EVariable(at_, x_))
|
|
4049
|
-
})),
|
|
4105
|
+
})), []);
|
|
4050
4106
|
const effect2_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, at_);
|
|
4051
|
-
const lambda_ = ff_compiler_Syntax.ELambda(at_, ff_compiler_Syntax.Lambda(at_, effect2_,
|
|
4107
|
+
const lambda_ = ff_compiler_Syntax.ELambda(at_, ff_compiler_Syntax.Lambda(at_, effect2_, [ff_compiler_Syntax.MatchCase(at_, ff_core_List.List_map(parameters_, ((_w1) => {
|
|
4052
4108
|
return ff_compiler_Syntax.PVariable(at_, ff_core_Option.Some(_w1))
|
|
4053
|
-
})),
|
|
4109
|
+
})), [], body_)]));
|
|
4054
4110
|
return ff_compiler_Inference.Inference_inferTerm(self_, (((_c) => {
|
|
4055
4111
|
return ff_compiler_Environment.Environment(_c.modulePrefix_, _c.symbols_, _c.traits_, _c.imports_, effect2_, _c.selfVariable_)
|
|
4056
4112
|
}))(environment_), expected_, lambda_)
|
|
@@ -4076,7 +4132,8 @@ return
|
|
|
4076
4132
|
}
|
|
4077
4133
|
}))
|
|
4078
4134
|
};
|
|
4079
|
-
let remainingArguments_ = arguments_;
|
|
4135
|
+
let remainingArguments_ = ff_core_List.List_toArray(arguments_);
|
|
4136
|
+
ff_core_Array.Array_reverse(remainingArguments_);
|
|
4080
4137
|
const newArguments_ = ff_core_List.List_map(parameters_, ((p_) => {
|
|
4081
4138
|
const t_ = p_.valueType_;
|
|
4082
4139
|
function defaultArgument_() {
|
|
@@ -4091,36 +4148,23 @@ return ff_compiler_Syntax.Argument(callAt_, ff_core_Option.Some(p_.name_), ff_co
|
|
|
4091
4148
|
}
|
|
4092
4149
|
}))
|
|
4093
4150
|
}
|
|
4094
|
-
{
|
|
4095
|
-
const _1 = remainingArguments_;
|
|
4096
|
-
{
|
|
4097
|
-
if(_1.Empty) {
|
|
4151
|
+
if(ff_core_Array.Array_isEmpty(remainingArguments_)) {
|
|
4098
4152
|
return defaultArgument_()
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
if(_1.head_.name_.None) {
|
|
4106
|
-
const e_ = _1.head_.value_;
|
|
4107
|
-
const remaining_ = _1.tail_;
|
|
4108
|
-
remainingArguments_ = remaining_;
|
|
4109
|
-
const e2_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, e_);
|
|
4110
|
-
return ff_compiler_Syntax.Argument(at_, ff_core_Option.Some(p_.name_), e2_)
|
|
4111
|
-
return
|
|
4112
|
-
}
|
|
4113
|
-
}
|
|
4114
|
-
}
|
|
4115
|
-
{
|
|
4116
|
-
return ff_core_Option.Option_else(ff_core_Option.Option_map(ff_core_List.List_find(remainingArguments_, ((_w1) => {
|
|
4153
|
+
} else if(ff_core_Option.Option_isEmpty(ff_core_Array.Array_grabLast(remainingArguments_).name_)) {
|
|
4154
|
+
const a_ = ff_core_Option.Option_grab(ff_core_Array.Array_pop(remainingArguments_));
|
|
4155
|
+
const e2_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, a_.value_);
|
|
4156
|
+
return ff_compiler_Syntax.Argument(a_.at_, ff_core_Option.Some(p_.name_), e2_)
|
|
4157
|
+
} else {
|
|
4158
|
+
return ff_core_Option.Option_else(ff_core_Option.Option_map(ff_core_Array.Array_find(remainingArguments_, ((_w1) => {
|
|
4117
4159
|
return ff_core_Option.Option_contains(_w1.name_, p_.name_, ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String)
|
|
4118
4160
|
})), ((_1) => {
|
|
4119
4161
|
{
|
|
4120
4162
|
const at_ = _1.at_;
|
|
4121
4163
|
const e_ = _1.value_;
|
|
4122
|
-
|
|
4123
|
-
return
|
|
4164
|
+
ff_core_Option.Option_each(ff_core_Array.Array_indexWhere(remainingArguments_, ((_w1) => {
|
|
4165
|
+
return ff_core_Option.Option_contains(_w1.name_, p_.name_, ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String)
|
|
4166
|
+
})), ((_w1) => {
|
|
4167
|
+
ff_core_Array.Array_delete(remainingArguments_, _w1, 1)
|
|
4124
4168
|
}));
|
|
4125
4169
|
const e2_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, e_);
|
|
4126
4170
|
return ff_compiler_Syntax.Argument(at_, ff_core_Option.Some(p_.name_), e2_)
|
|
@@ -4129,12 +4173,10 @@ return
|
|
|
4129
4173
|
})), (() => {
|
|
4130
4174
|
return defaultArgument_()
|
|
4131
4175
|
}))
|
|
4132
|
-
return
|
|
4133
|
-
}
|
|
4134
4176
|
}
|
|
4135
4177
|
}));
|
|
4136
4178
|
if((!ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_))) {
|
|
4137
|
-
ff_core_Option.Option_each(
|
|
4179
|
+
ff_core_Option.Option_each(ff_core_Array.Array_first(remainingArguments_), ((_1) => {
|
|
4138
4180
|
{
|
|
4139
4181
|
const callAt_ = _1.at_;
|
|
4140
4182
|
if(_1.name_.None) {
|
|
@@ -4153,7 +4195,7 @@ return
|
|
|
4153
4195
|
}));
|
|
4154
4196
|
return newArguments_
|
|
4155
4197
|
} else {
|
|
4156
|
-
return
|
|
4198
|
+
return [...newArguments_, ...ff_core_List.List_map(ff_core_Array.Array_drain(remainingArguments_), ((a_) => {
|
|
4157
4199
|
{
|
|
4158
4200
|
const _1 = a_;
|
|
4159
4201
|
{
|
|
@@ -4162,7 +4204,7 @@ return ff_compiler_Syntax.Argument(_c.at_, _c.name_, ff_compiler_Inference.Infer
|
|
|
4162
4204
|
return
|
|
4163
4205
|
}
|
|
4164
4206
|
}
|
|
4165
|
-
}))
|
|
4207
|
+
}))]
|
|
4166
4208
|
}
|
|
4167
4209
|
}
|
|
4168
4210
|
|
|
@@ -4170,7 +4212,7 @@ export async function Inference_lookup$(self_, environment_, expected_, at_, sym
|
|
|
4170
4212
|
return ff_core_Option.Option_elseIf(ff_compiler_Inference.Inference_lookupOption(self_, environment_, expected_, at_, symbol_, typeArguments_), (() => {
|
|
4171
4213
|
return ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)
|
|
4172
4214
|
}), (() => {
|
|
4173
|
-
const instantiated_ = ff_compiler_Environment.Instantiated(
|
|
4215
|
+
const instantiated_ = ff_compiler_Environment.Instantiated([], ff_compiler_Environment.Scheme(ff_core_Option.Option_isEmpty(arguments_), false, false, false, ff_compiler_Syntax.Signature(at_, symbol_, false, [], [], ff_core_List.List_map(ff_core_List.List_pairs(ff_core_List.List_flatten(ff_core_Option.Option_toList(arguments_))), ((_1) => {
|
|
4174
4216
|
{
|
|
4175
4217
|
const i_ = _1.first_;
|
|
4176
4218
|
const a_ = _1.second_;
|
|
@@ -4204,7 +4246,7 @@ const instantiation_ = ((!ff_core_List.List_isEmpty(typeArguments_))
|
|
|
4204
4246
|
const newTypeArguments_ = (((!scheme_.isVariable_) && ff_core_Option.Option_any(ff_core_List.List_first(scheme_.signature_.generics_), ((_w1) => {
|
|
4205
4247
|
return (_w1 === "Q$")
|
|
4206
4248
|
})))
|
|
4207
|
-
?
|
|
4249
|
+
? [ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, at_), ...typeArguments_]
|
|
4208
4250
|
: typeArguments_);
|
|
4209
4251
|
if(((ff_core_List.List_size(scheme_.signature_.generics_) !== ff_core_List.List_size(newTypeArguments_)) && (!ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)))) {
|
|
4210
4252
|
const extra_ = (ff_core_List.List_size(newTypeArguments_) - ff_core_List.List_size(typeArguments_));
|
|
@@ -4235,7 +4277,7 @@ return ff_compiler_Unification.Unification_instantiate(self_.unification_, insta
|
|
|
4235
4277
|
ff_compiler_Unification.Unification_constrain(self_.unification_, at_, ff_core_List.List_grabFirst(generics_), c_.name_, ff_core_List.List_dropFirst(generics_, 1))
|
|
4236
4278
|
}));
|
|
4237
4279
|
const signature_ = (((_c) => {
|
|
4238
|
-
return ff_compiler_Syntax.Signature(_c.at_, _c.name_, _c.member_,
|
|
4280
|
+
return ff_compiler_Syntax.Signature(_c.at_, _c.name_, _c.member_, [], [], parameters_, returnType_, effect_)
|
|
4239
4281
|
}))(scheme_.signature_);
|
|
4240
4282
|
const instantiated_ = ff_compiler_Environment.Instantiated(instantiation_, (((_c) => {
|
|
4241
4283
|
return ff_compiler_Environment.Scheme(_c.isVariable_, _c.isMutable_, _c.isNewtype_, _c.isTraitMethod_, signature_)
|