We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 698debf commit c7f2e99Copy full SHA for c7f2e99
1 file changed
go/ql/lib/semmle/go/Expr.qll
@@ -754,13 +754,19 @@ class SliceExpr extends @sliceexpr, Expr {
754
*
755
* ```go
756
* x.(T)
757
+ * x.(type)
758
* ```
759
*/
760
class TypeAssertExpr extends @typeassertexpr, Expr {
761
/** Gets the base expression whose type is being asserted. */
762
Expr getExpr() { result = this.getChildExpr(0) }
763
- /** Gets the expression representing the asserted type. */
764
+ /**
765
+ * Gets the expression representing the asserted type.
766
+ *
767
+ * Note that this is not defined when the type assertion is of the form
768
+ * `x.(type)`, as found in type switches.
769
+ */
770
Expr getTypeExpr() { result = this.getChildExpr(1) }
771
772
override predicate mayHaveOwnSideEffects() { any() }
0 commit comments