Skip to content

Commit

Permalink
Investigate failing workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladiwostok committed Mar 3, 2024
1 parent 3c12dd7 commit 11e1dbf
Showing 1 changed file with 38 additions and 38 deletions.
76 changes: 38 additions & 38 deletions src/dscanner/analysis/ifelsesame.d
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ extern (C++) class IfElseSameCheck(AST) : BaseAnalyzerDmd
}

mixin VisitBinaryExpression!(AST.LogicalExp);
mixin VisitBinaryExpression!(AST.EqualExp);
mixin VisitBinaryExpression!(AST.CmpExp);
mixin VisitBinaryExpression!(AST.AssignExp);
//mixin VisitBinaryExpression!(AST.EqualExp);
//mixin VisitBinaryExpression!(AST.CmpExp);
//mixin VisitBinaryExpression!(AST.AssignExp);

private template VisitBinaryExpression(NodeType)
{
Expand Down Expand Up @@ -153,41 +153,41 @@ unittest
}
}c, sac);

assertAnalyzerWarningsDMD(q{
void testCmpExprSame()
{
int a = 1, b = 2;

if (a == b) {}
if (a == a) {} // [warn]: Left side of '==' operator is identical to right side.

if (a != b) {}
if (a != a) {} // [warn]: Left side of '!=' operator is identical to right side.

b = a == a ? 1 : 2; // [warn]: Left side of '==' operator is identical to right side.

if (a > b) {}
if (a > a) {} // [warn]: Left side of '>' operator is identical to right side.

if (a < b) {}
if (a < a) {} // [warn]: Left side of '<' operator is identical to right side.

if (a >= b) {}
if (a >= a) {} // [warn]: Left side of '>=' operator is identical to right side.

if (a <= b) {}
if (a <= a) {} // [warn]: Left side of '<=' operator is identical to right side.
}
}c, sac);

assertAnalyzerWarningsDMD(q{
void testAssignSame()
{
int a = 1;
a = 5;
a = a; // [warn]: Left side of assignment operation is identical to the right side.
}
}c, sac);
//assertAnalyzerWarningsDMD(q{
// void testCmpExprSame()
// {
// int a = 1, b = 2;
//
// if (a == b) {}
// if (a == a) {} // [warn]: Left side of '==' operator is identical to right side.
//
// if (a != b) {}
// if (a != a) {} // [warn]: Left side of '!=' operator is identical to right side.
//
// b = a == a ? 1 : 2; // [warn]: Left side of '==' operator is identical to right side.
//
// if (a > b) {}
// if (a > a) {} // [warn]: Left side of '>' operator is identical to right side.
//
// if (a < b) {}
// if (a < a) {} // [warn]: Left side of '<' operator is identical to right side.
//
// if (a >= b) {}
// if (a >= a) {} // [warn]: Left side of '>=' operator is identical to right side.
//
// if (a <= b) {}
// if (a <= a) {} // [warn]: Left side of '<=' operator is identical to right side.
// }
//}c, sac);

//assertAnalyzerWarningsDMD(q{
// void testAssignSame()
// {
// int a = 1;
// a = 5;
// a = a; // [warn]: Left side of assignment operation is identical to the right side.
// }
//}c, sac);

assertAnalyzerWarningsDMD(q{
void foo()
Expand Down

0 comments on commit 11e1dbf

Please sign in to comment.