firefly-compiler 0.5.13 → 0.5.15
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/JsEmitter.ff +27 -6
- package/fireflysite/Test.ff +8 -2
- package/fireflysite/assets/markdown/reference/FunctionsAndMethods.md +33 -13
- package/output/js/ff/compiler/Builder.mjs +8 -4
- package/output/js/ff/compiler/Compiler.mjs +8 -4
- package/output/js/ff/compiler/Deriver.mjs +2 -2
- package/output/js/ff/compiler/Inference.mjs +68 -48
- package/output/js/ff/compiler/JsEmitter.mjs +102 -34
- package/output/js/ff/compiler/Parser.mjs +70 -62
- package/output/js/ff/compiler/Patterns.mjs +4 -4
- package/output/js/ff/compiler/Resolver.mjs +10 -6
- package/output/js/ff/compiler/Tokenizer.mjs +2 -2
- package/output/js/ff/compiler/Unification.mjs +18 -10
- package/output/js/ff/compiler/Workspace.mjs +20 -18
- package/output/js/ff/core/Array.mjs +8 -8
- package/output/js/ff/core/List.mjs +46 -42
- package/output/js/ff/core/Ordering.mjs +4 -4
- package/output/js/ff/core/Random.mjs +8 -8
- package/output/js/ff/core/Serializable.mjs +8 -8
- package/output/js/ff/core/Task.mjs +2 -2
- package/package.json +1 -1
- package/vscode/package.json +1 -1
package/compiler/JsEmitter.ff
CHANGED
|
@@ -516,15 +516,27 @@ extend self: JsEmitter {
|
|
|
516
516
|
Some("(" + operator + self.emitTerm(value, async) + ")")
|
|
517
517
|
| operator {!operator.grabFirst().isAsciiLetter()} {arguments | [left, right]} =>
|
|
518
518
|
Some("(" + self.emitTerm(left, async) + " " + operator + " " + self.emitTerm(right, async) + ")")
|
|
519
|
-
| "ff:core/List.List_grab" {arguments | [
|
|
519
|
+
| "ff:core/List.List_grab" {arguments | [e1, e2]} {noSideEffects(e1) && noSideEffects(e2)} =>
|
|
520
|
+
let code1 = self.emitTerm(e1, async)
|
|
521
|
+
let code2 = self.emitTerm(e2, async)
|
|
520
522
|
Some(
|
|
521
|
-
"(" +
|
|
522
|
-
"ff_core_List.internalGrab_(" +
|
|
523
|
+
"(" + code1 + "[" + code2 + "] ?? " +
|
|
524
|
+
"ff_core_List.internalGrab_(" + code1 + ", " + code2 + "))"
|
|
523
525
|
)
|
|
524
|
-
| "ff:core/Array.Array_grab" {arguments | [
|
|
526
|
+
| "ff:core/Array.Array_grab" {arguments | [e1, e2]} =>
|
|
527
|
+
let code1 = self.emitTerm(e1, async)
|
|
528
|
+
let code2 = self.emitTerm(e2, async)
|
|
525
529
|
Some(
|
|
526
|
-
"(" +
|
|
527
|
-
"ff_core_Array.internalGrab_(" +
|
|
530
|
+
"(" + code1 + ".array[" + code2 + "] ?? " +
|
|
531
|
+
"ff_core_Array.internalGrab_(" + code1 + ", " + code2 + "))"
|
|
532
|
+
)
|
|
533
|
+
| "ff:core/List.List_size" {arguments | [e]} =>
|
|
534
|
+
Some(
|
|
535
|
+
self.emitTerm(e, async) + ".length"
|
|
536
|
+
)
|
|
537
|
+
| "ff:core/Array.Array_size" {arguments | [e]} =>
|
|
538
|
+
Some(
|
|
539
|
+
self.emitTerm(e, async) + ".array.length"
|
|
528
540
|
)
|
|
529
541
|
| "ff:core/Equal.equals" {arguments | [left, right]} {dictionaries | [Dictionary(_, _, _, typeName, [])]} {
|
|
530
542
|
primitiveTypes.contains(typeName) || typeName == "ff:core/Ordering.Ordering"
|
|
@@ -680,6 +692,15 @@ extend self: JsEmitter {
|
|
|
680
692
|
invokeImmediately(doWhileBody) | body
|
|
681
693
|
} =>
|
|
682
694
|
Some("while(" + self.emitComma(body, async) + ") {}")
|
|
695
|
+
| "ff:core/Option.Option_each" {arguments | [list, ELambda(_, Lambda(_, _, [
|
|
696
|
+
MatchCase(_, [PVariable(_, name)], [], body)
|
|
697
|
+
]))]} =>
|
|
698
|
+
Some(
|
|
699
|
+
"for(let for_o = " + self.emitTerm(list, async) + "; for_o.Some;) {\n" +
|
|
700
|
+
name.map {"const " + escapeKeyword(_) + " = for_o.value_;\n"}.else {""} +
|
|
701
|
+
self.emitStatements(body, last, async) +
|
|
702
|
+
"\nbreak\n}"
|
|
703
|
+
)
|
|
683
704
|
| "ff:core/List.List_each" {arguments | [
|
|
684
705
|
ECall(_, StaticCall(r, _, _), _, _, [start, end], _)
|
|
685
706
|
ELambda(_, Lambda(_, _, [MatchCase(_, [PVariable(_, name)], [], body)]))
|
package/fireflysite/Test.ff
CHANGED
|
@@ -27,12 +27,18 @@ nodeMain(system: NodeSystem) {
|
|
|
27
27
|
let foo = {{_ + 1}(_)}
|
|
28
28
|
Log.show(foo(1))
|
|
29
29
|
|
|
30
|
+
/*
|
|
30
31
|
let x1 = work(initial = 3) {i =>
|
|
31
32
|
i + 1
|
|
32
33
|
} {s =>
|
|
33
34
|
"*" + s + "*"
|
|
34
|
-
}
|
|
35
|
+
}*/
|
|
35
36
|
//let x2 = work(initial = 3, {i => i + 1}, {s => s + "*"})
|
|
37
|
+
|
|
38
|
+
let array = Array.new()
|
|
39
|
+
while {array.size() < 5} {
|
|
40
|
+
array.push("X")
|
|
41
|
+
}
|
|
36
42
|
}
|
|
37
43
|
|
|
38
44
|
factorial(n: Int): Int {
|
|
@@ -53,4 +59,4 @@ factorialTail(n: Int, acc: Int = 1): Int {
|
|
|
53
59
|
|
|
54
60
|
work(f: Int => Int, g: String => String, initial: Int = 0): String {
|
|
55
61
|
g("" + f(initial))
|
|
56
|
-
}
|
|
62
|
+
}
|
|
@@ -240,51 +240,70 @@ let f: Int => Int = {{_ + 1}(_)}
|
|
|
240
240
|
In this code, there is an outer and an inner anonymous function, both taking one argument. The first underscore belongs to the inner function, which is called immediately by the outer function with the outer function's anonymous parameter as the argument.
|
|
241
241
|
|
|
242
242
|
|
|
243
|
-
# Trailing
|
|
243
|
+
# Trailing Anonymous Function Arguments
|
|
244
244
|
|
|
245
|
-
Firefly has special syntax for
|
|
245
|
+
Firefly has a special syntax for calling functions with function arguments. When a call has a sequence of literal anonymous functions as the last arguments, these arguments may be given using this special syntax. Consider the `if` function from the standard library, with this signature:
|
|
246
246
|
|
|
247
247
|
```firefly
|
|
248
248
|
if[T](condition: Bool, body: () => T): Option[T]
|
|
249
249
|
```
|
|
250
250
|
|
|
251
|
-
The `if` function takes two parameters, where the last is a function. Calling `if` with the standard syntax
|
|
251
|
+
The `if` function takes two parameters, where the last is a function. Calling `if` with the standard syntax could look like this:
|
|
252
252
|
|
|
253
253
|
```firefly
|
|
254
254
|
if(x == 0, {"Zero"})
|
|
255
255
|
```
|
|
256
256
|
|
|
257
|
-
Using the special syntax for trailing
|
|
257
|
+
Using the special syntax for trailing anonymous function arguments, it looks like this:
|
|
258
258
|
|
|
259
259
|
```firefly
|
|
260
260
|
if(x == 0) {"Zero"}
|
|
261
261
|
```
|
|
262
262
|
|
|
263
|
-
With this
|
|
263
|
+
With this syntax, the anonymous function is written after the call parentheses. Multiple trailing function arguments may be given in sequence. Consider the `while` function from the standard library, with this signature:
|
|
264
264
|
|
|
265
|
-
|
|
265
|
+
```firefly
|
|
266
|
+
while(condition: () => Bool, body: () => Unit): Unit
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
The `while` function takes two parameters, both functions. Using the special syntax, a call to `while` may look like this:
|
|
266
270
|
|
|
267
271
|
```firefly
|
|
268
|
-
|
|
269
|
-
|
|
272
|
+
while {array.size() < 5} {
|
|
273
|
+
array.push("X")
|
|
270
274
|
}
|
|
271
275
|
```
|
|
272
276
|
|
|
273
|
-
|
|
277
|
+
The code above will push a string to an array while the size of the array is less than 5.
|
|
278
|
+
|
|
279
|
+
This syntax for trailing anonymous function arguments allows the use of `if` and `while` to resemble constructs in languages such as C and JavaScript, where these constructs are built-in keywords rather than functions.
|
|
280
|
+
|
|
281
|
+
# Trailing Colon Function Argument
|
|
282
|
+
|
|
283
|
+
Firefly has a variation of the trailing anonymous function argument syntax. The very last anonymous function argument may be written after a colon, without curly braces. The purpose of this syntax is to avoid aditional indentation.
|
|
284
|
+
|
|
285
|
+
The example below calls `if` with a trailing colon function argument:
|
|
274
286
|
|
|
275
287
|
```firefly
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
"*" + s + "*"
|
|
288
|
+
safeFactorial(n: Int, acc: Int = 1): Option[Int] {
|
|
289
|
+
if(n >= 0):
|
|
290
|
+
factorial(n)
|
|
280
291
|
}
|
|
281
292
|
```
|
|
282
293
|
|
|
294
|
+
In this example, the `if` function is called with the condition `n >= 0` and an anonymous function that computes `factorial(n)`. If `n` is negative, the `if` function returns `None` and so does `safeFactorial`. Using the colon syntax, the `safeFactorial` functions continues unindented otherwise.
|
|
295
|
+
|
|
283
296
|
|
|
284
297
|
# Local functions
|
|
285
298
|
|
|
286
299
|
Local functions are declared exactly like top-level functions but with the `function` keyword in front of the signature, like this:
|
|
287
300
|
|
|
301
|
+
```firefly
|
|
302
|
+
function square(n: Int): Int {
|
|
303
|
+
n * n
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
288
307
|
The above local function definition is a statement, similar to local variables declared with `let`. The function name `square` will be in scope for the rest of the code block.
|
|
289
308
|
|
|
290
309
|
Furthermore, local functions declared in sequence are in scope within each other's bodies, allowing them to be mutually recursive.
|
|
@@ -323,6 +342,7 @@ extend self[T]: Option[T] {
|
|
|
323
342
|
}
|
|
324
343
|
```
|
|
325
344
|
|
|
345
|
+
|
|
326
346
|
Methods can be defined for a more narrow targer type, like `flatten` below:
|
|
327
347
|
|
|
328
348
|
```firefly
|
|
@@ -137,9 +137,11 @@ if(printMeasurements_) {
|
|
|
137
137
|
ff_compiler_Compiler.Compiler_printMeasurements(compiler_)
|
|
138
138
|
};
|
|
139
139
|
ff_core_Map.Map_each(resolvedDependencies_.packagePaths_, ((packagePair_, packagePath_) => {
|
|
140
|
-
|
|
140
|
+
for(let for_o = ff_core_Map.Map_get(resolvedDependencies_.packages_, packagePair_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair); for_o.Some;) {
|
|
141
|
+
const packageInfo_ = for_o.value_;
|
|
141
142
|
ff_compiler_Builder.processIncludes_(jsPathFile_, packagePath_, packageInfo_)
|
|
142
|
-
|
|
143
|
+
break
|
|
144
|
+
}
|
|
143
145
|
}), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair);
|
|
144
146
|
return true
|
|
145
147
|
}));
|
|
@@ -334,9 +336,11 @@ if(printMeasurements_) {
|
|
|
334
336
|
(await ff_compiler_Compiler.Compiler_printMeasurements$(compiler_, $task))
|
|
335
337
|
};
|
|
336
338
|
(await ff_core_Map.Map_each$(resolvedDependencies_.packagePaths_, (async (packagePair_, packagePath_, $task) => {
|
|
337
|
-
(
|
|
339
|
+
for(let for_o = ff_core_Map.Map_get(resolvedDependencies_.packages_, packagePair_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair); for_o.Some;) {
|
|
340
|
+
const packageInfo_ = for_o.value_;
|
|
338
341
|
(await ff_compiler_Builder.processIncludes_$(jsPathFile_, packagePath_, packageInfo_, $task))
|
|
339
|
-
|
|
342
|
+
break
|
|
343
|
+
}
|
|
340
344
|
}), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair, $task));
|
|
341
345
|
return true
|
|
342
346
|
}), $task));
|
|
@@ -171,11 +171,13 @@ return ff_compiler_ModuleCache.ModuleCache_cacheParsedModule(self_.cache_, self_
|
|
|
171
171
|
const packageName_ = ff_compiler_Syntax.PackagePair_groupName(packagePair_, ":");
|
|
172
172
|
return ff_compiler_Compiler.Compiler_measure(self_, "Parse", packagePair_, moduleName_, (() => {
|
|
173
173
|
const code_ = ff_core_Option.Option_else(ff_core_Map.Map_get(self_.virtualFiles_, ff_core_Path.Path_absolute(path_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), (() => {
|
|
174
|
-
|
|
174
|
+
for(let for_o = importedAt_; for_o.Some;) {
|
|
175
|
+
const at_ = for_o.value_;
|
|
175
176
|
if((!ff_core_Path.Path_exists(path_, false, false, false))) {
|
|
176
177
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ((("Imported module not found: " + packageName_) + "/") + moduleName_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
177
178
|
}
|
|
178
|
-
|
|
179
|
+
break
|
|
180
|
+
};
|
|
179
181
|
return ff_core_Path.Path_readText(path_)
|
|
180
182
|
}));
|
|
181
183
|
const completionAt_ = ((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && self_.lspHook_.insertIdentifier_)
|
|
@@ -302,11 +304,13 @@ return (await ff_compiler_ModuleCache.ModuleCache_cacheParsedModule$(self_.cache
|
|
|
302
304
|
const packageName_ = ff_compiler_Syntax.PackagePair_groupName(packagePair_, ":");
|
|
303
305
|
return (await ff_compiler_Compiler.Compiler_measure$(self_, "Parse", packagePair_, moduleName_, (async ($task) => {
|
|
304
306
|
const code_ = (await ff_core_Option.Option_else$(ff_core_Map.Map_get(self_.virtualFiles_, (await ff_core_Path.Path_absolute$(path_, $task)), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), (async ($task) => {
|
|
305
|
-
(
|
|
307
|
+
for(let for_o = importedAt_; for_o.Some;) {
|
|
308
|
+
const at_ = for_o.value_;
|
|
306
309
|
if((!(await ff_core_Path.Path_exists$(path_, false, false, false, $task)))) {
|
|
307
310
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ((("Imported module not found: " + packageName_) + "/") + moduleName_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
308
311
|
}
|
|
309
|
-
|
|
312
|
+
break
|
|
313
|
+
};
|
|
310
314
|
return (await ff_core_Path.Path_readText$(path_, $task))
|
|
311
315
|
}), $task));
|
|
312
316
|
const completionAt_ = ((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && self_.lspHook_.insertIdentifier_)
|
|
@@ -203,7 +203,7 @@ const variants_ = _1;
|
|
|
203
203
|
return ff_core_List.List_map(variants_, ((variant_) => {
|
|
204
204
|
const variantName_ = ((modulePrefix_ + ".") + variant_.name_);
|
|
205
205
|
const fields_ = [...declaration_.commonFields_, ...variant_.fields_];
|
|
206
|
-
const strings_ = ((
|
|
206
|
+
const strings_ = ((fields_.length === 0)
|
|
207
207
|
? []
|
|
208
208
|
: [ff_compiler_Syntax.EString(at_, "\"(\""), ...ff_core_List.List_separate(ff_core_List.List_map(fields_, ((field_) => {
|
|
209
209
|
return ff_compiler_Deriver.Deriver_makeSimpleCall(self_, at_, "ff:core/Show.show", [ff_compiler_Syntax.EField(at_, false, ff_compiler_Syntax.EVariable(at_, "z"), field_.name_)], [])
|
|
@@ -605,7 +605,7 @@ const variants_ = _1;
|
|
|
605
605
|
return ff_core_List.List_map(variants_, ((variant_) => {
|
|
606
606
|
const variantName_ = ((modulePrefix_ + ".") + variant_.name_);
|
|
607
607
|
const fields_ = [...declaration_.commonFields_, ...variant_.fields_];
|
|
608
|
-
const strings_ = ((
|
|
608
|
+
const strings_ = ((fields_.length === 0)
|
|
609
609
|
? []
|
|
610
610
|
: [ff_compiler_Syntax.EString(at_, "\"(\""), ...ff_core_List.List_separate(ff_core_List.List_map(fields_, ((field_) => {
|
|
611
611
|
return ff_compiler_Deriver.Deriver_makeSimpleCall(self_, at_, "ff:core/Show.show", [ff_compiler_Syntax.EField(at_, false, ff_compiler_Syntax.EVariable(at_, "z"), field_.name_)], [])
|
|
@@ -213,8 +213,8 @@ const traitName_ = definition_.traitName_;
|
|
|
213
213
|
const traitDefinition_ = ff_core_Option.Option_else(ff_core_Map.Map_get(environment_.traits_, traitName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), (() => {
|
|
214
214
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(definition_.at_, ("No such trait: " + traitName_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
215
215
|
}));
|
|
216
|
-
if((
|
|
217
|
-
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(definition_.at_, ((((("Wrong number of type arguments for " + traitName_) + ", expected ") + (
|
|
216
|
+
if((traitDefinition_.generics_.length !== definition_.typeArguments_.length)) {
|
|
217
|
+
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(definition_.at_, ((((("Wrong number of type arguments for " + traitName_) + ", expected ") + (traitDefinition_.generics_.length - 1)) + ", got ") + (definition_.typeArguments_.length - 1))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
218
218
|
};
|
|
219
219
|
const instantiationMap_ = ff_core_List.List_toMap(ff_core_List.List_zip(traitDefinition_.generics_, definition_.typeArguments_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
|
|
220
220
|
for(let for_i = 0, for_a = traitDefinition_.methods_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
@@ -252,11 +252,11 @@ return ff_compiler_Syntax.Parameter(_c.at_, _c.mutable_, _c.name_, ff_compiler_U
|
|
|
252
252
|
}
|
|
253
253
|
}));
|
|
254
254
|
const returnType_ = ff_compiler_Unification.Unification_instantiate(self_.unification_, instantiationMap_, traitMethodScheme_.signature_.returnType_);
|
|
255
|
-
for(let for_i = Math.max(
|
|
255
|
+
for(let for_i = Math.max(parameters_.length, 0), for_a = instanceFunction_.signature_.parameters_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
256
256
|
const instanceParameter_ = for_a[for_i];
|
|
257
257
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(instanceParameter_.at_, ("Unexpected parameter: " + instanceParameter_.name_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
258
258
|
};
|
|
259
|
-
for(let for_i = Math.max(
|
|
259
|
+
for(let for_i = Math.max(instanceFunction_.signature_.parameters_.length, 0), for_a = parameters_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
260
260
|
const traitParameter_ = for_a[for_i];
|
|
261
261
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(instanceFunction_.at_, ("Missing parameter: " + traitParameter_.name_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
262
262
|
};
|
|
@@ -353,7 +353,7 @@ return ff_compiler_Environment.Environment(_c.modulePrefix_, ff_core_Map.Map_add
|
|
|
353
353
|
const parameterTypes_ = ff_core_List.List_map(parameters_, ((_w1) => {
|
|
354
354
|
return _w1.second_.signature_.returnType_
|
|
355
355
|
}));
|
|
356
|
-
const functionType_ = ff_compiler_Syntax.TConstructor(definition_.at_, ("Function$" +
|
|
356
|
+
const functionType_ = ff_compiler_Syntax.TConstructor(definition_.at_, ("Function$" + parameterTypes_.length), [definition_.signature_.effect_, ...parameterTypes_, definition_.signature_.returnType_]);
|
|
357
357
|
const instances_ = ff_compiler_Inference.constraintsToInstances_(definition_.signature_.constraints_);
|
|
358
358
|
return ff_compiler_Unification.Unification_withLocalInstances(self_.unification_, instances_, (() => {
|
|
359
359
|
{
|
|
@@ -424,7 +424,7 @@ const parameterTypes_ = ff_core_List.List_map(case_.patterns_, ((_w1) => {
|
|
|
424
424
|
return ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, _w1.at_)
|
|
425
425
|
}));
|
|
426
426
|
const returnType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, case_.at_);
|
|
427
|
-
const functionType_ = ff_compiler_Syntax.TConstructor(case_.at_, ("Function$" +
|
|
427
|
+
const functionType_ = ff_compiler_Syntax.TConstructor(case_.at_, ("Function$" + case_.patterns_.length), [environment_.effect_, ...parameterTypes_, returnType_]);
|
|
428
428
|
ff_compiler_Unification.Unification_unify(self_.unification_, case_.at_, expected_, functionType_);
|
|
429
429
|
const environment1_ = ff_core_List.List_foldLeft(ff_core_List.List_zip(parameterTypes_, case_.patterns_), environment_, ((_1, _2) => {
|
|
430
430
|
{
|
|
@@ -608,8 +608,8 @@ const instantiated_ = ff_core_Option.Option_else(ff_compiler_Inference.Inference
|
|
|
608
608
|
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)})
|
|
609
609
|
}));
|
|
610
610
|
ff_compiler_Unification.Unification_unify(self_.unification_, at_, expected_, instantiated_.scheme_.signature_.returnType_);
|
|
611
|
-
if(((
|
|
612
|
-
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, (((("Wrong number of subpatterns, expected " +
|
|
611
|
+
if(((patterns_.length !== instantiated_.scheme_.signature_.parameters_.length) && (!ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)))) {
|
|
612
|
+
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, (((("Wrong number of subpatterns, expected " + instantiated_.scheme_.signature_.parameters_.length) + ", got ") + patterns_.length) + ".")), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
613
613
|
};
|
|
614
614
|
return ff_core_List.List_foldLeft(ff_core_List.List_map(ff_core_List.List_zip(patterns_, instantiated_.scheme_.signature_.parameters_), ((_1) => {
|
|
615
615
|
{
|
|
@@ -669,9 +669,11 @@ if(_1.EField) {
|
|
|
669
669
|
const e_ = _1;
|
|
670
670
|
const recordType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
|
|
671
671
|
if(ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, term_.at_)) {
|
|
672
|
-
|
|
672
|
+
for(let for_o = hookRecordTypeBox_; for_o.Some;) {
|
|
673
|
+
const _w1 = for_o.value_;
|
|
673
674
|
_w1.value_ = ff_core_Option.Some(recordType_)
|
|
674
|
-
|
|
675
|
+
break
|
|
676
|
+
}
|
|
675
677
|
};
|
|
676
678
|
const record_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, recordType_, e_.record_);
|
|
677
679
|
{
|
|
@@ -737,7 +739,7 @@ if((!instantiated_.scheme_.isVariable_)) {
|
|
|
737
739
|
const signature_ = (((_c) => {
|
|
738
740
|
return ff_compiler_Syntax.Signature(_c.at_, _c.name_, _c.member_, _c.generics_, _c.constraints_, ff_core_List.List_dropFirst(instantiated_.scheme_.signature_.parameters_, 1), _c.returnType_, _c.effect_)
|
|
739
741
|
}))(instantiated_.scheme_.signature_);
|
|
740
|
-
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, recordType_, ff_core_List.
|
|
742
|
+
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, recordType_, (instantiated_.scheme_.signature_.parameters_[0] ?? ff_core_List.internalGrab_(instantiated_.scheme_.signature_.parameters_, 0)).valueType_);
|
|
741
743
|
return ff_compiler_Inference.Inference_inferEtaExpansion(self_, environment_, expected_, e_.at_, signature_, term_)
|
|
742
744
|
}
|
|
743
745
|
}
|
|
@@ -1201,9 +1203,11 @@ if(_1.EField) {
|
|
|
1201
1203
|
const f_ = _1;
|
|
1202
1204
|
const recordType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, f_.at_);
|
|
1203
1205
|
if(ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, term_.at_)) {
|
|
1204
|
-
|
|
1206
|
+
for(let for_o = hookRecordTypeBox_; for_o.Some;) {
|
|
1207
|
+
const _w1 = for_o.value_;
|
|
1205
1208
|
_w1.value_ = ff_core_Option.Some(recordType_)
|
|
1206
|
-
|
|
1209
|
+
break
|
|
1210
|
+
}
|
|
1207
1211
|
};
|
|
1208
1212
|
const record_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, recordType_, f_.record_);
|
|
1209
1213
|
const e2_ = (((_c) => {
|
|
@@ -1497,15 +1501,17 @@ const effect_ = ff_compiler_Unification.Unification_freshUnificationVariable(sel
|
|
|
1497
1501
|
const argumentTypes_ = ff_core_List.List_map(e_.arguments_, ((_w1) => {
|
|
1498
1502
|
return ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, _w1.at_)
|
|
1499
1503
|
}));
|
|
1500
|
-
const functionType_ = ff_compiler_Syntax.TConstructor(e_.at_, ("Function$" +
|
|
1504
|
+
const functionType_ = ff_compiler_Syntax.TConstructor(e_.at_, ("Function$" + e_.arguments_.length), [effect_, ...argumentTypes_, expected_]);
|
|
1501
1505
|
const function_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, functionType_, call_.function_);
|
|
1502
1506
|
const arguments_ = ff_core_List.List_map(ff_core_List.List_zip(e_.arguments_, argumentTypes_), ((_1) => {
|
|
1503
1507
|
{
|
|
1504
1508
|
const argument_ = _1.first_;
|
|
1505
1509
|
const t_ = _1.second_;
|
|
1506
|
-
|
|
1510
|
+
for(let for_o = argument_.name_; for_o.Some;) {
|
|
1511
|
+
const name_ = for_o.value_;
|
|
1507
1512
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(argument_.at_, ("Named argument not allowed here: " + name_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
1508
|
-
|
|
1513
|
+
break
|
|
1514
|
+
};
|
|
1509
1515
|
{
|
|
1510
1516
|
const _1 = argument_;
|
|
1511
1517
|
{
|
|
@@ -1516,9 +1522,11 @@ return ff_compiler_Syntax.Argument(_c.at_, _c.name_, ff_compiler_Inference.Infer
|
|
|
1516
1522
|
return
|
|
1517
1523
|
}
|
|
1518
1524
|
}));
|
|
1519
|
-
|
|
1525
|
+
for(let for_o = ff_core_List.List_first(e_.typeArguments_); for_o.Some;) {
|
|
1526
|
+
const typeArgument_ = for_o.value_;
|
|
1520
1527
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(typeArgument_.at_, "Type arguments not allowed here"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
1521
|
-
|
|
1528
|
+
break
|
|
1529
|
+
};
|
|
1522
1530
|
ff_compiler_Unification.Unification_affect(self_.unification_, term_.at_, effect_, environment_.effect_);
|
|
1523
1531
|
{
|
|
1524
1532
|
const _1 = e_;
|
|
@@ -1881,11 +1889,13 @@ return ff_core_Option.Option_contains(_w1.name_, p_.name_, ff_core_Equal.ff_core
|
|
|
1881
1889
|
{
|
|
1882
1890
|
const at_ = _1.at_;
|
|
1883
1891
|
const e_ = _1.value_;
|
|
1884
|
-
|
|
1892
|
+
for(let for_o = ff_core_Array.Array_indexWhere(remainingArguments_, ((_w1) => {
|
|
1885
1893
|
return ff_core_Option.Option_contains(_w1.name_, p_.name_, ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String)
|
|
1886
|
-
}))
|
|
1894
|
+
})); for_o.Some;) {
|
|
1895
|
+
const _w1 = for_o.value_;
|
|
1887
1896
|
ff_core_Array.Array_delete(remainingArguments_, _w1, 1)
|
|
1888
|
-
|
|
1897
|
+
break
|
|
1898
|
+
};
|
|
1889
1899
|
const e2_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, e_);
|
|
1890
1900
|
return ff_compiler_Syntax.Argument(at_, ff_core_Option.Some(p_.name_), e2_)
|
|
1891
1901
|
}
|
|
@@ -1962,9 +1972,9 @@ return (_w1 === "Q$")
|
|
|
1962
1972
|
})))
|
|
1963
1973
|
? [ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, at_), ...typeArguments_]
|
|
1964
1974
|
: typeArguments_);
|
|
1965
|
-
if(((
|
|
1966
|
-
const extra_ = (
|
|
1967
|
-
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ((((("Wrong number of type arguments for " + symbol_) + ", expected ") + (
|
|
1975
|
+
if(((scheme_.signature_.generics_.length !== newTypeArguments_.length) && (!ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)))) {
|
|
1976
|
+
const extra_ = (newTypeArguments_.length - typeArguments_.length);
|
|
1977
|
+
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ((((("Wrong number of type arguments for " + symbol_) + ", expected ") + (scheme_.signature_.generics_.length - extra_)) + ", got ") + (newTypeArguments_.length - extra_))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
1968
1978
|
};
|
|
1969
1979
|
return ff_core_List.List_zip(scheme_.signature_.generics_, newTypeArguments_)
|
|
1970
1980
|
})()
|
|
@@ -2065,8 +2075,8 @@ const traitName_ = definition_.traitName_;
|
|
|
2065
2075
|
const traitDefinition_ = ff_core_Option.Option_else(ff_core_Map.Map_get(environment_.traits_, traitName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), (() => {
|
|
2066
2076
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(definition_.at_, ("No such trait: " + traitName_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
2067
2077
|
}));
|
|
2068
|
-
if((
|
|
2069
|
-
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(definition_.at_, ((((("Wrong number of type arguments for " + traitName_) + ", expected ") + (
|
|
2078
|
+
if((traitDefinition_.generics_.length !== definition_.typeArguments_.length)) {
|
|
2079
|
+
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(definition_.at_, ((((("Wrong number of type arguments for " + traitName_) + ", expected ") + (traitDefinition_.generics_.length - 1)) + ", got ") + (definition_.typeArguments_.length - 1))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
2070
2080
|
};
|
|
2071
2081
|
const instantiationMap_ = ff_core_List.List_toMap(ff_core_List.List_zip(traitDefinition_.generics_, definition_.typeArguments_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
|
|
2072
2082
|
for(let for_i = 0, for_a = traitDefinition_.methods_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
@@ -2104,11 +2114,11 @@ return ff_compiler_Syntax.Parameter(_c.at_, _c.mutable_, _c.name_, ff_compiler_U
|
|
|
2104
2114
|
}
|
|
2105
2115
|
}));
|
|
2106
2116
|
const returnType_ = ff_compiler_Unification.Unification_instantiate(self_.unification_, instantiationMap_, traitMethodScheme_.signature_.returnType_);
|
|
2107
|
-
for(let for_i = Math.max(
|
|
2117
|
+
for(let for_i = Math.max(parameters_.length, 0), for_a = instanceFunction_.signature_.parameters_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
2108
2118
|
const instanceParameter_ = for_a[for_i];
|
|
2109
2119
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(instanceParameter_.at_, ("Unexpected parameter: " + instanceParameter_.name_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
2110
2120
|
};
|
|
2111
|
-
for(let for_i = Math.max(
|
|
2121
|
+
for(let for_i = Math.max(instanceFunction_.signature_.parameters_.length, 0), for_a = parameters_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
2112
2122
|
const traitParameter_ = for_a[for_i];
|
|
2113
2123
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(instanceFunction_.at_, ("Missing parameter: " + traitParameter_.name_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
2114
2124
|
};
|
|
@@ -2205,7 +2215,7 @@ return ff_compiler_Environment.Environment(_c.modulePrefix_, ff_core_Map.Map_add
|
|
|
2205
2215
|
const parameterTypes_ = ff_core_List.List_map(parameters_, ((_w1) => {
|
|
2206
2216
|
return _w1.second_.signature_.returnType_
|
|
2207
2217
|
}));
|
|
2208
|
-
const functionType_ = ff_compiler_Syntax.TConstructor(definition_.at_, ("Function$" +
|
|
2218
|
+
const functionType_ = ff_compiler_Syntax.TConstructor(definition_.at_, ("Function$" + parameterTypes_.length), [definition_.signature_.effect_, ...parameterTypes_, definition_.signature_.returnType_]);
|
|
2209
2219
|
const instances_ = ff_compiler_Inference.constraintsToInstances_(definition_.signature_.constraints_);
|
|
2210
2220
|
return ff_compiler_Unification.Unification_withLocalInstances(self_.unification_, instances_, (() => {
|
|
2211
2221
|
{
|
|
@@ -2276,7 +2286,7 @@ const parameterTypes_ = ff_core_List.List_map(case_.patterns_, ((_w1) => {
|
|
|
2276
2286
|
return ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, _w1.at_)
|
|
2277
2287
|
}));
|
|
2278
2288
|
const returnType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, case_.at_);
|
|
2279
|
-
const functionType_ = ff_compiler_Syntax.TConstructor(case_.at_, ("Function$" +
|
|
2289
|
+
const functionType_ = ff_compiler_Syntax.TConstructor(case_.at_, ("Function$" + case_.patterns_.length), [environment_.effect_, ...parameterTypes_, returnType_]);
|
|
2280
2290
|
ff_compiler_Unification.Unification_unify(self_.unification_, case_.at_, expected_, functionType_);
|
|
2281
2291
|
const environment1_ = ff_core_List.List_foldLeft(ff_core_List.List_zip(parameterTypes_, case_.patterns_), environment_, ((_1, _2) => {
|
|
2282
2292
|
{
|
|
@@ -2460,8 +2470,8 @@ const instantiated_ = ff_core_Option.Option_else(ff_compiler_Inference.Inference
|
|
|
2460
2470
|
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)})
|
|
2461
2471
|
}));
|
|
2462
2472
|
ff_compiler_Unification.Unification_unify(self_.unification_, at_, expected_, instantiated_.scheme_.signature_.returnType_);
|
|
2463
|
-
if(((
|
|
2464
|
-
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, (((("Wrong number of subpatterns, expected " +
|
|
2473
|
+
if(((patterns_.length !== instantiated_.scheme_.signature_.parameters_.length) && (!ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)))) {
|
|
2474
|
+
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, (((("Wrong number of subpatterns, expected " + instantiated_.scheme_.signature_.parameters_.length) + ", got ") + patterns_.length) + ".")), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
2465
2475
|
};
|
|
2466
2476
|
return ff_core_List.List_foldLeft(ff_core_List.List_map(ff_core_List.List_zip(patterns_, instantiated_.scheme_.signature_.parameters_), ((_1) => {
|
|
2467
2477
|
{
|
|
@@ -2521,9 +2531,11 @@ if(_1.EField) {
|
|
|
2521
2531
|
const e_ = _1;
|
|
2522
2532
|
const recordType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
|
|
2523
2533
|
if(ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, term_.at_)) {
|
|
2524
|
-
|
|
2534
|
+
for(let for_o = hookRecordTypeBox_; for_o.Some;) {
|
|
2535
|
+
const _w1 = for_o.value_;
|
|
2525
2536
|
_w1.value_ = ff_core_Option.Some(recordType_)
|
|
2526
|
-
|
|
2537
|
+
break
|
|
2538
|
+
}
|
|
2527
2539
|
};
|
|
2528
2540
|
const record_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, recordType_, e_.record_);
|
|
2529
2541
|
{
|
|
@@ -2589,7 +2601,7 @@ if((!instantiated_.scheme_.isVariable_)) {
|
|
|
2589
2601
|
const signature_ = (((_c) => {
|
|
2590
2602
|
return ff_compiler_Syntax.Signature(_c.at_, _c.name_, _c.member_, _c.generics_, _c.constraints_, ff_core_List.List_dropFirst(instantiated_.scheme_.signature_.parameters_, 1), _c.returnType_, _c.effect_)
|
|
2591
2603
|
}))(instantiated_.scheme_.signature_);
|
|
2592
|
-
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, recordType_, ff_core_List.
|
|
2604
|
+
ff_compiler_Unification.Unification_unify(self_.unification_, e_.at_, recordType_, (instantiated_.scheme_.signature_.parameters_[0] ?? ff_core_List.internalGrab_(instantiated_.scheme_.signature_.parameters_, 0)).valueType_);
|
|
2593
2605
|
return ff_compiler_Inference.Inference_inferEtaExpansion(self_, environment_, expected_, e_.at_, signature_, term_)
|
|
2594
2606
|
}
|
|
2595
2607
|
}
|
|
@@ -3053,9 +3065,11 @@ if(_1.EField) {
|
|
|
3053
3065
|
const f_ = _1;
|
|
3054
3066
|
const recordType_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, f_.at_);
|
|
3055
3067
|
if(ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, term_.at_)) {
|
|
3056
|
-
|
|
3068
|
+
for(let for_o = hookRecordTypeBox_; for_o.Some;) {
|
|
3069
|
+
const _w1 = for_o.value_;
|
|
3057
3070
|
_w1.value_ = ff_core_Option.Some(recordType_)
|
|
3058
|
-
|
|
3071
|
+
break
|
|
3072
|
+
}
|
|
3059
3073
|
};
|
|
3060
3074
|
const record_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, recordType_, f_.record_);
|
|
3061
3075
|
const e2_ = (((_c) => {
|
|
@@ -3349,15 +3363,17 @@ const effect_ = ff_compiler_Unification.Unification_freshUnificationVariable(sel
|
|
|
3349
3363
|
const argumentTypes_ = ff_core_List.List_map(e_.arguments_, ((_w1) => {
|
|
3350
3364
|
return ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, _w1.at_)
|
|
3351
3365
|
}));
|
|
3352
|
-
const functionType_ = ff_compiler_Syntax.TConstructor(e_.at_, ("Function$" +
|
|
3366
|
+
const functionType_ = ff_compiler_Syntax.TConstructor(e_.at_, ("Function$" + e_.arguments_.length), [effect_, ...argumentTypes_, expected_]);
|
|
3353
3367
|
const function_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, functionType_, call_.function_);
|
|
3354
3368
|
const arguments_ = ff_core_List.List_map(ff_core_List.List_zip(e_.arguments_, argumentTypes_), ((_1) => {
|
|
3355
3369
|
{
|
|
3356
3370
|
const argument_ = _1.first_;
|
|
3357
3371
|
const t_ = _1.second_;
|
|
3358
|
-
|
|
3372
|
+
for(let for_o = argument_.name_; for_o.Some;) {
|
|
3373
|
+
const name_ = for_o.value_;
|
|
3359
3374
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(argument_.at_, ("Named argument not allowed here: " + name_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
3360
|
-
|
|
3375
|
+
break
|
|
3376
|
+
};
|
|
3361
3377
|
{
|
|
3362
3378
|
const _1 = argument_;
|
|
3363
3379
|
{
|
|
@@ -3368,9 +3384,11 @@ return ff_compiler_Syntax.Argument(_c.at_, _c.name_, ff_compiler_Inference.Infer
|
|
|
3368
3384
|
return
|
|
3369
3385
|
}
|
|
3370
3386
|
}));
|
|
3371
|
-
|
|
3387
|
+
for(let for_o = ff_core_List.List_first(e_.typeArguments_); for_o.Some;) {
|
|
3388
|
+
const typeArgument_ = for_o.value_;
|
|
3372
3389
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(typeArgument_.at_, "Type arguments not allowed here"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
3373
|
-
|
|
3390
|
+
break
|
|
3391
|
+
};
|
|
3374
3392
|
ff_compiler_Unification.Unification_affect(self_.unification_, term_.at_, effect_, environment_.effect_);
|
|
3375
3393
|
{
|
|
3376
3394
|
const _1 = e_;
|
|
@@ -3733,11 +3751,13 @@ return ff_core_Option.Option_contains(_w1.name_, p_.name_, ff_core_Equal.ff_core
|
|
|
3733
3751
|
{
|
|
3734
3752
|
const at_ = _1.at_;
|
|
3735
3753
|
const e_ = _1.value_;
|
|
3736
|
-
|
|
3754
|
+
for(let for_o = ff_core_Array.Array_indexWhere(remainingArguments_, ((_w1) => {
|
|
3737
3755
|
return ff_core_Option.Option_contains(_w1.name_, p_.name_, ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String)
|
|
3738
|
-
}))
|
|
3756
|
+
})); for_o.Some;) {
|
|
3757
|
+
const _w1 = for_o.value_;
|
|
3739
3758
|
ff_core_Array.Array_delete(remainingArguments_, _w1, 1)
|
|
3740
|
-
|
|
3759
|
+
break
|
|
3760
|
+
};
|
|
3741
3761
|
const e2_ = ff_compiler_Inference.Inference_inferTerm(self_, environment_, t_, e_);
|
|
3742
3762
|
return ff_compiler_Syntax.Argument(at_, ff_core_Option.Some(p_.name_), e2_)
|
|
3743
3763
|
}
|
|
@@ -3814,9 +3834,9 @@ return (_w1 === "Q$")
|
|
|
3814
3834
|
})))
|
|
3815
3835
|
? [ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, at_), ...typeArguments_]
|
|
3816
3836
|
: typeArguments_);
|
|
3817
|
-
if(((
|
|
3818
|
-
const extra_ = (
|
|
3819
|
-
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ((((("Wrong number of type arguments for " + symbol_) + ", expected ") + (
|
|
3837
|
+
if(((scheme_.signature_.generics_.length !== newTypeArguments_.length) && (!ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)))) {
|
|
3838
|
+
const extra_ = (newTypeArguments_.length - typeArguments_.length);
|
|
3839
|
+
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ((((("Wrong number of type arguments for " + symbol_) + ", expected ") + (scheme_.signature_.generics_.length - extra_)) + ", got ") + (newTypeArguments_.length - extra_))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
3820
3840
|
};
|
|
3821
3841
|
return ff_core_List.List_zip(scheme_.signature_.generics_, newTypeArguments_)
|
|
3822
3842
|
})()
|