Skip to content

Commit 1db6bac

Browse files
Copilotowen-mc
andauthored
Fix compiler errors and warnings: remove redundant type checks and isIn guards, mark implicitFieldSelection as additional
Agent-Logs-Url: https://github.com/github/codeql/sessions/8d96128c-44db-4ba1-9eca-1a5b37f54442 Co-authored-by: owen-mc <62447351+owen-mc@users.noreply.github.com>
1 parent 507a0c1 commit 1db6bac

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

go/ql/lib/semmle/go/controlflow/ControlFlowGraphShared.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ module GoCfg {
524524
private predicate notBlankIdent(Go::Expr e) { not e instanceof Go::BlankIdent }
525525

526526
/** Helper: implicit field selection for promoted selectors */
527-
predicate implicitFieldSelection(Ast::AstNode e, int index, Go::Field implicitField) {
527+
additional predicate implicitFieldSelection(Ast::AstNode e, int index, Go::Field implicitField) {
528528
exists(Go::StructType baseType, Go::PromotedField child, int implicitFieldDepth |
529529
baseType = e.(Go::PromotedSelector).getSelectedStructType() and
530530
(

go/ql/lib/semmle/go/controlflow/IR.qll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ module IR {
2626
or
2727
this.isAdditional(_, _)
2828
or
29-
this.isAfterTrue(_) and not this.isIn(_)
29+
this.isAfterTrue(_)
3030
or
31-
this.isAfterFalse(_) and not this.isIn(_)
31+
this.isAfterFalse(_)
3232
}
3333

3434
/** Holds if this instruction reads the value of variable or constant `v`. */
@@ -164,9 +164,9 @@ module IR {
164164
/** A condition guard instruction, representing a known boolean outcome for a condition. */
165165
private class ConditionGuardInstruction extends Instruction {
166166
ConditionGuardInstruction() {
167-
this.isAfterTrue(_) and not this.isIn(_)
167+
this.isAfterTrue(_)
168168
or
169-
this.isAfterFalse(_) and not this.isIn(_)
169+
this.isAfterFalse(_)
170170
}
171171
}
172172

@@ -176,7 +176,7 @@ module IR {
176176
class EvalInstruction extends Instruction {
177177
Expr e;
178178

179-
EvalInstruction() { this.isIn(e) and e instanceof Expr }
179+
EvalInstruction() { this.isIn(e) }
180180

181181
/** Gets the expression underlying this instruction. */
182182
Expr getExpr() { result = e }
@@ -778,7 +778,7 @@ module IR {
778778
class DeclareFunctionInstruction extends Instruction {
779779
FuncDecl fd;
780780

781-
DeclareFunctionInstruction() { this.isIn(fd) and fd instanceof FuncDecl }
781+
DeclareFunctionInstruction() { this.isIn(fd) }
782782

783783
override Type getResultType() { result = fd.getType() }
784784
}

0 commit comments

Comments
 (0)