mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
16 lines
448 B
Plaintext
16 lines
448 B
Plaintext
/**
|
|
* @name Conditional expressions
|
|
* @description Finds conditional expressions of the form '... ? ... : ...'
|
|
* where the types of the resulting expressions differ.
|
|
* @tags conditional
|
|
* type
|
|
*/
|
|
|
|
import csharp
|
|
|
|
from ConditionalExpr e
|
|
where e.getThen().stripImplicitCasts() != e.getElse().stripImplicitCasts()
|
|
and not e.getThen().getType() instanceof NullType
|
|
and not e.getElse().getType() instanceof NullType
|
|
select e
|