Skip to content

Commit

Permalink
Fix bug stil4m#243 Incorrect "Unnecessary parens"
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Baker committed Dec 31, 2020
1 parent 701b8b4 commit d74c96d
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 165 deletions.
43 changes: 14 additions & 29 deletions dist/app/backend-elm.js
Original file line number Diff line number Diff line change
Expand Up @@ -15425,6 +15425,13 @@ var $stil4m$elm_syntax$Elm$Syntax$Expression$isCase = function (e) {
return false;
}
};
var $stil4m$elm_syntax$Elm$Syntax$Expression$isIfElse = function (e) {
if (e.$ === 4) {
return true;
} else {
return false;
}
};
var $stil4m$elm_syntax$Elm$Syntax$Expression$isLambda = function (e) {
if (e.$ === 17) {
return true;
Expand All @@ -15441,6 +15448,9 @@ var $stil4m$elm_syntax$Elm$Syntax$Expression$isOperatorApplication = function (e
};
var $author$project$Analyser$Checks$UnnecessaryParens$onApplication = F2(
function (parts, context) {
var needsParentheses = function (e) {
return $stil4m$elm_syntax$Elm$Syntax$Expression$isOperatorApplication(e) || ($stil4m$elm_syntax$Elm$Syntax$Expression$isCase(e) || ($stil4m$elm_syntax$Elm$Syntax$Expression$isLambda(e) || $stil4m$elm_syntax$Elm$Syntax$Expression$isIfElse(e)));
};
return A2(
$elm$core$Maybe$withDefault,
context,
Expand All @@ -15460,29 +15470,11 @@ var $author$project$Analyser$Checks$UnnecessaryParens$onApplication = F2(
A2(
$elm$core$Basics$composeR,
$stil4m$elm_syntax$Elm$Syntax$Node$value,
A2($elm$core$Basics$composeR, $stil4m$elm_syntax$Elm$Syntax$Expression$isLambda, $elm$core$Basics$not))),
A2($elm$core$Basics$composeR, needsParentheses, $elm$core$Basics$not))),
A2(
$elm_community$maybe_extra$Maybe$Extra$filter,
A2(
$elm$core$Basics$composeR,
$elm$core$Tuple$second,
A2(
$elm$core$Basics$composeR,
$stil4m$elm_syntax$Elm$Syntax$Node$value,
A2($elm$core$Basics$composeR, $stil4m$elm_syntax$Elm$Syntax$Expression$isCase, $elm$core$Basics$not))),
A2(
$elm_community$maybe_extra$Maybe$Extra$filter,
A2(
$elm$core$Basics$composeR,
$elm$core$Tuple$second,
A2(
$elm$core$Basics$composeR,
$stil4m$elm_syntax$Elm$Syntax$Node$value,
A2($elm$core$Basics$composeR, $stil4m$elm_syntax$Elm$Syntax$Expression$isOperatorApplication, $elm$core$Basics$not))),
A2(
$elm$core$Maybe$andThen,
$author$project$Analyser$Checks$UnnecessaryParens$getParenthesized,
$elm$core$List$head(parts))))))));
$elm$core$Maybe$andThen,
$author$project$Analyser$Checks$UnnecessaryParens$getParenthesized,
$elm$core$List$head(parts))))));
});
var $author$project$Analyser$Checks$UnnecessaryParens$onCaseBlock = F2(
function (caseBlock, context) {
Expand Down Expand Up @@ -15519,13 +15511,6 @@ var $author$project$Analyser$Checks$UnnecessaryParens$onListExpr = F2(
$elm$core$Tuple$first,
A2($elm$core$List$filterMap, $author$project$Analyser$Checks$UnnecessaryParens$getParenthesized, exprs)));
});
var $stil4m$elm_syntax$Elm$Syntax$Expression$isIfElse = function (e) {
if (e.$ === 4) {
return true;
} else {
return false;
}
};
var $stil4m$elm_syntax$Elm$Syntax$Expression$isLet = function (e) {
if (e.$ === 15) {
return true;
Expand Down
43 changes: 14 additions & 29 deletions dist/public/client-elm.js
Original file line number Diff line number Diff line change
Expand Up @@ -10996,6 +10996,13 @@ var $stil4m$elm_syntax$Elm$Syntax$Expression$isCase = function (e) {
return false;
}
};
var $stil4m$elm_syntax$Elm$Syntax$Expression$isIfElse = function (e) {
if (e.$ === 4) {
return true;
} else {
return false;
}
};
var $stil4m$elm_syntax$Elm$Syntax$Expression$isLambda = function (e) {
if (e.$ === 17) {
return true;
Expand All @@ -11012,6 +11019,9 @@ var $stil4m$elm_syntax$Elm$Syntax$Expression$isOperatorApplication = function (e
};
var $author$project$Analyser$Checks$UnnecessaryParens$onApplication = F2(
function (parts, context) {
var needsParentheses = function (e) {
return $stil4m$elm_syntax$Elm$Syntax$Expression$isOperatorApplication(e) || ($stil4m$elm_syntax$Elm$Syntax$Expression$isCase(e) || ($stil4m$elm_syntax$Elm$Syntax$Expression$isLambda(e) || $stil4m$elm_syntax$Elm$Syntax$Expression$isIfElse(e)));
};
return A2(
$elm$core$Maybe$withDefault,
context,
Expand All @@ -11031,29 +11041,11 @@ var $author$project$Analyser$Checks$UnnecessaryParens$onApplication = F2(
A2(
$elm$core$Basics$composeR,
$stil4m$elm_syntax$Elm$Syntax$Node$value,
A2($elm$core$Basics$composeR, $stil4m$elm_syntax$Elm$Syntax$Expression$isLambda, $elm$core$Basics$not))),
A2($elm$core$Basics$composeR, needsParentheses, $elm$core$Basics$not))),
A2(
$elm_community$maybe_extra$Maybe$Extra$filter,
A2(
$elm$core$Basics$composeR,
$elm$core$Tuple$second,
A2(
$elm$core$Basics$composeR,
$stil4m$elm_syntax$Elm$Syntax$Node$value,
A2($elm$core$Basics$composeR, $stil4m$elm_syntax$Elm$Syntax$Expression$isCase, $elm$core$Basics$not))),
A2(
$elm_community$maybe_extra$Maybe$Extra$filter,
A2(
$elm$core$Basics$composeR,
$elm$core$Tuple$second,
A2(
$elm$core$Basics$composeR,
$stil4m$elm_syntax$Elm$Syntax$Node$value,
A2($elm$core$Basics$composeR, $stil4m$elm_syntax$Elm$Syntax$Expression$isOperatorApplication, $elm$core$Basics$not))),
A2(
$elm$core$Maybe$andThen,
$author$project$Analyser$Checks$UnnecessaryParens$getParenthesized,
$elm$core$List$head(parts))))))));
$elm$core$Maybe$andThen,
$author$project$Analyser$Checks$UnnecessaryParens$getParenthesized,
$elm$core$List$head(parts))))));
});
var $author$project$Analyser$Checks$UnnecessaryParens$onCaseBlock = F2(
function (caseBlock, context) {
Expand Down Expand Up @@ -11090,13 +11082,6 @@ var $author$project$Analyser$Checks$UnnecessaryParens$onListExpr = F2(
$elm$core$Tuple$first,
A2($elm$core$List$filterMap, $author$project$Analyser$Checks$UnnecessaryParens$getParenthesized, exprs)));
});
var $stil4m$elm_syntax$Elm$Syntax$Expression$isIfElse = function (e) {
if (e.$ === 4) {
return true;
} else {
return false;
}
};
var $stil4m$elm_syntax$Elm$Syntax$Expression$isLet = function (e) {
if (e.$ === 15) {
return true;
Expand Down
Loading

0 comments on commit d74c96d

Please sign in to comment.