firefly-compiler 0.4.25 → 0.4.27
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/Inference.ff
CHANGED
|
@@ -376,14 +376,14 @@ extend self: Inference {
|
|
|
376
376
|
| TConstructor(_, name, typeArguments)@t {name.startsWith("Record$")} =>
|
|
377
377
|
let fieldNames = name.split('$').dropFirst(1)
|
|
378
378
|
if(self.lspHook.isEnabled()) {
|
|
379
|
-
fieldNames.zip(typeArguments).
|
|
379
|
+
let definedAt = fieldNames.zip(typeArguments).collectFirst {| Pair(fieldName, fieldType) =>
|
|
380
380
|
if(e.field == fieldName):
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
)
|
|
386
|
-
|
|
381
|
+
self.unification.substitute(fieldType).at
|
|
382
|
+
}
|
|
383
|
+
if(self.lspHook.isAt(e.at) || definedAt.any {self.lspHook.isDefinedAt(_)}) {
|
|
384
|
+
self.lspHook.emit(
|
|
385
|
+
InferRecordFieldHook(e.at, self.unification, environment, expected, t, e.field)
|
|
386
|
+
)
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
fieldNames.pairs().find {_.second == e.field}.map {_.first}.map {index =>
|
|
@@ -675,19 +675,21 @@ const typeArguments_ = _1.generics_;
|
|
|
675
675
|
if(ff_core_String.String_startsWith(name_, "Record$", 0)) {
|
|
676
676
|
const fieldNames_ = ff_core_List.List_dropFirst(ff_core_String.String_split(name_, 36), 1);
|
|
677
677
|
if(ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) {
|
|
678
|
-
ff_core_List.
|
|
678
|
+
const definedAt_ = ff_core_List.List_collectFirst(ff_core_List.List_zip(fieldNames_, typeArguments_), ((_1) => {
|
|
679
679
|
{
|
|
680
680
|
const fieldName_ = _1.first_;
|
|
681
681
|
const fieldType_ = _1.second_;
|
|
682
682
|
if((e_.field_ === fieldName_)) {
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferRecordFieldHook(e_.at_, self_.unification_, environment_, expected_, t_, e_.field_))
|
|
686
|
-
}
|
|
687
|
-
}
|
|
683
|
+
return ff_core_Option.Some(ff_compiler_Unification.Unification_substitute(self_.unification_, fieldType_).at_)
|
|
684
|
+
} else return ff_core_Option.None()
|
|
688
685
|
return
|
|
689
686
|
}
|
|
690
|
-
}))
|
|
687
|
+
}));
|
|
688
|
+
if((ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, e_.at_) || ff_core_Option.Option_any(definedAt_, ((_w1) => {
|
|
689
|
+
return ff_compiler_LspHook.LspHook_isDefinedAt(self_.lspHook_, _w1)
|
|
690
|
+
})))) {
|
|
691
|
+
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferRecordFieldHook(e_.at_, self_.unification_, environment_, expected_, t_, e_.field_))
|
|
692
|
+
}
|
|
691
693
|
};
|
|
692
694
|
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) => {
|
|
693
695
|
return (_w1.second_ === e_.field_)
|
|
@@ -2350,19 +2352,21 @@ const typeArguments_ = _1.generics_;
|
|
|
2350
2352
|
if(ff_core_String.String_startsWith(name_, "Record$", 0)) {
|
|
2351
2353
|
const fieldNames_ = ff_core_List.List_dropFirst(ff_core_String.String_split(name_, 36), 1);
|
|
2352
2354
|
if(ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) {
|
|
2353
|
-
ff_core_List.
|
|
2355
|
+
const definedAt_ = ff_core_List.List_collectFirst(ff_core_List.List_zip(fieldNames_, typeArguments_), ((_1) => {
|
|
2354
2356
|
{
|
|
2355
2357
|
const fieldName_ = _1.first_;
|
|
2356
2358
|
const fieldType_ = _1.second_;
|
|
2357
2359
|
if((e_.field_ === fieldName_)) {
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferRecordFieldHook(e_.at_, self_.unification_, environment_, expected_, t_, e_.field_))
|
|
2361
|
-
}
|
|
2362
|
-
}
|
|
2360
|
+
return ff_core_Option.Some(ff_compiler_Unification.Unification_substitute(self_.unification_, fieldType_).at_)
|
|
2361
|
+
} else return ff_core_Option.None()
|
|
2363
2362
|
return
|
|
2364
2363
|
}
|
|
2365
|
-
}))
|
|
2364
|
+
}));
|
|
2365
|
+
if((ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, e_.at_) || ff_core_Option.Option_any(definedAt_, ((_w1) => {
|
|
2366
|
+
return ff_compiler_LspHook.LspHook_isDefinedAt(self_.lspHook_, _w1)
|
|
2367
|
+
})))) {
|
|
2368
|
+
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferRecordFieldHook(e_.at_, self_.unification_, environment_, expected_, t_, e_.field_))
|
|
2369
|
+
}
|
|
2366
2370
|
};
|
|
2367
2371
|
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) => {
|
|
2368
2372
|
return (_w1.second_ === e_.field_)
|
package/package.json
CHANGED
|
@@ -35,5 +35,14 @@
|
|
|
35
35
|
"indentationRules": {
|
|
36
36
|
"increaseIndentPattern": "^((?!\\/\\/).)*(\\{[^}\"'`]*|\\([^)\"'`]*|\\[[^\\]\"'`]*|=>.*)$",
|
|
37
37
|
"decreaseIndentPattern": "^((?!.*?\\/\\*).*\\*/)?\\s*[\\)\\}\\]|].*$"
|
|
38
|
-
}
|
|
38
|
+
},
|
|
39
|
+
"onEnterRules": [
|
|
40
|
+
{
|
|
41
|
+
"beforeText": "({|=>)\\s*$",
|
|
42
|
+
"afterText": "^\\s*}",
|
|
43
|
+
"action": {
|
|
44
|
+
"indent": "indentOutdent"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
]
|
|
39
48
|
}
|