Kotlin: Add paramTypes test

This commit is contained in:
Ian Lynagh
2021-11-25 15:26:17 +00:00
parent d5b4931b7f
commit 547b60d68f
2 changed files with 27 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
| superChain.kt:1:1:1:33 | SuperChain1 | 0 | superChain.kt:1:24:1:25 | T1 |
| superChain.kt:1:1:1:33 | SuperChain1 | 1 | superChain.kt:1:28:1:29 | T2 |
| superChain.kt:1:1:1:33 | SuperChain1<T3,String> | 0 | superChain.kt:2:24:2:25 | T3 |
| superChain.kt:1:1:1:33 | SuperChain1<T3,String> | 1 | file://<external>/String.class:0:0:0:0 | String |
| superChain.kt:2:1:2:60 | SuperChain2 | 0 | superChain.kt:2:24:2:25 | T3 |
| superChain.kt:2:1:2:60 | SuperChain2 | 1 | superChain.kt:2:28:2:29 | T4 |
| superChain.kt:2:1:2:60 | SuperChain2<T5,String> | 0 | superChain.kt:3:24:3:25 | T5 |
| superChain.kt:2:1:2:60 | SuperChain2<T5,String> | 1 | file://<external>/String.class:0:0:0:0 | String |
| superChain.kt:3:1:3:60 | SuperChain3 | 0 | superChain.kt:3:24:3:25 | T5 |
| superChain.kt:3:1:3:60 | SuperChain3 | 1 | superChain.kt:3:28:3:29 | T6 |

View File

@@ -0,0 +1,17 @@
import java
// Stop external filepaths from appearing in the results
class ClassLocation extends Class {
override predicate hasLocationInfo(string path, int sl, int sc, int el, int ec) {
exists(string fullPath |
super.hasLocationInfo(fullPath, sl, sc, el, ec) |
if exists(this.getFile().getRelativePath())
then path = fullPath
else path = fullPath.regexpReplaceAll(".*/", "<external>/"))
}
}
from ParameterizedClass c, int i
where c.getSourceDeclaration().fromSource()
select c, i, c.getTypeArgument(i)