correct suggestion order also in body of lambda function
This commit is contained in:
parent
1ff4b181ff
commit
24689b3783
7 changed files with 24 additions and 15 deletions
12
src/eval.ts
12
src/eval.ts
|
|
@ -86,9 +86,6 @@ const mergeMaps = (...maps: Map<Type,Type>[]) => {
|
|||
|
||||
export function evalCallBlock2(fnResolved: ResolvedType, inputResolved: ResolvedType, env): ResolvedType {
|
||||
if (getSymbol(fnResolved.t) !== symbolFunction) {
|
||||
if (fnResolved.kind === "unknown") {
|
||||
return entirelyUnknown(env); // don't flash everything red, giving the user a heart attack
|
||||
}
|
||||
// worst outcome: we know nothing about the result!
|
||||
return {
|
||||
kind: "error",
|
||||
|
|
@ -102,8 +99,7 @@ export function evalCallBlock2(fnResolved: ResolvedType, inputResolved: Resolved
|
|||
// fn is a function...
|
||||
const [outType, substitutions] = assignFnSubstitutions(fnResolved.t, inputResolved.t); // may throw
|
||||
|
||||
// console.log('assignFn...', prettyT(fnResolved.t), prettyT(inputResolved.t), '\nout =', prettyT(outType), substitutions);
|
||||
|
||||
// console.log('assignFn...', prettyT(fnResolved.t), inputResolved.i, prettyT(inputResolved.t), '\nout =', prettyT(outType), substitutions);
|
||||
|
||||
const mergedSubstitutions = mergeMaps(substitutions, fnResolved.substitutions, inputResolved.substitutions);
|
||||
|
||||
|
|
@ -284,12 +280,12 @@ export function attemptParseLiteral(text: string, env): Dynamic[] {
|
|||
|
||||
export function scoreResolved(resolved: ResolvedType, outPriority: (s:ResolvedType) => number) {
|
||||
const bias = outPriority(resolved);
|
||||
|
||||
|
||||
if (resolved.kind === "value") {
|
||||
return 1 + bias;
|
||||
return 2 + bias;
|
||||
}
|
||||
else if (resolved.kind === "unknown") {
|
||||
return 0 + bias;
|
||||
return 1 + bias;
|
||||
}
|
||||
if (resolved.e instanceof UnifyError) {
|
||||
return -1 + bias; // parameter doesn't match
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue