Commit Graph

6082 Commits

Author SHA1 Message Date
Tamas Vajk
52597e5d63 Fix missing declarations in declaration stack 2022-05-10 19:51:13 +01:00
Tamas Vajk
482a37cfe3 Fix unbound symbol.owner references and add todos 2022-05-10 19:51:13 +01:00
Ian Lynagh
41c36760f7 Kotlin: Small refactorings and comments 2022-05-10 19:51:13 +01:00
Ian Lynagh
c0f194316f Kotlin: Update test following changes to casting operators 2022-05-10 19:51:13 +01:00
Ian Lynagh
ad33c47536 Kotlin: Add a test for Kotlin seeing Java code as properties 2022-05-10 19:51:13 +01:00
Ian Lynagh
579c590ea6 Kotlin: Accept test changes following "casting" operator changes 2022-05-10 19:51:13 +01:00
Ian Lynagh
6566f7b69f Kotlin: Add types for the different kinds of casts that Kotlin has
We might want to unify some of these in future, but doing that
correctly is easier than splitting them up correctly, so I've given each
one its own QL class for now.

I am not familiar with many of the libraries/queries that use CastExpr.
I've briefly looked at them and updated them in a way that looks
superficially reasonable, but some of the uses will probably want to be
refined later.
2022-05-10 19:51:13 +01:00
Ian Lynagh
7cf1289385 Kotlin: Fix build with old JDKs 2022-05-10 19:51:13 +01:00
Chris Smowton
221fa37081 Fix naming of local class instances that fall within generic functions 2022-05-10 19:51:13 +01:00
Ian Lynagh
735520a4ce Kotlin: Accept test changes in types test 2022-05-10 19:51:13 +01:00
Ian Lynagh
e9fcd4749a Kotlin: Use ASM9 rather than ASM7
This fixes
        exception: java.lang.UnsupportedOperationException: PermittedSubclasses requires ASM9
when we encounter ConstantDesc.class in the JDK's modules.
2022-05-10 19:51:13 +01:00
Tamas Vajk
646fc58c25 Fix expected test files 2022-05-10 19:51:13 +01:00
Tamas Vajk
44b731c68e Exclude extraction of fake overridden properties 2022-05-10 19:51:13 +01:00
Tamas Vajk
55b8e4400d Code quality improvements 2022-05-10 19:51:13 +01:00
Tamas Vajk
b6e5e1977d Extract more visibility modifiers 2022-05-10 19:51:13 +01:00
Ian Lynagh
a6d0dc7751 Kotlin: Small refactorings 2022-05-10 19:51:13 +01:00
Ian Lynagh
e1cff50c39 Kotlin: Remove KotlinSourceFileExtractor 2022-05-10 19:51:13 +01:00
Ian Lynagh
c1c4e4f86c Kotlin: Move extractFileContents into KotlinFileExtractor 2022-05-10 19:51:13 +01:00
Ian Lynagh
d43efd4cc7 Kotlin: KotlinSourceFileExtractor: Take filePath rather than file 2022-05-10 19:51:13 +01:00
Tamas Vajk
8e31bd8ec7 Update expected files after rebase 2022-05-10 19:51:13 +01:00
Tamas Vajk
9e21fa838e Test case for generic inner type instantiation 2022-05-10 19:51:13 +01:00
Chris Smowton
978978b86a Accept test changes 2022-05-10 19:51:13 +01:00
Chris Smowton
f4314c1f3d Substitute all generic types into function trap IDs and signatures, and ensure the subbed types are never primitive
The solution for ensuring they are primitive (making the range of the substitution always nullable) will need replacing once we export Kotlin types.
2022-05-10 19:51:12 +01:00
Chris Smowton
3365f3972e Instantiated generic type substitution: substitute outer class parameters too 2022-05-10 19:51:12 +01:00
Chris Smowton
fd495aa783 Name non-generic functions for their non-erased parameter types 2022-05-10 19:51:12 +01:00
Chris Smowton
f177c2c5ae Function trap ids: remove spaces between value parameters
Otherwise these won't match the IDs used by the Java extractor.
2022-05-10 19:51:12 +01:00
Chris Smowton
f38f03e6c9 Value parameters: provide correct source declaration 2022-05-10 19:51:12 +01:00
Chris Smowton
cd07cc448e Class trap labels: include outer type parameters 2022-05-10 19:51:12 +01:00
Chris Smowton
94efb427fe Type parameters: record index Java-style
Previously they received indices offset by the number of surrounding class type parameters.
2022-05-10 19:51:12 +01:00
Chris Smowton
178f128bdc Function labels: include <n> suffix (where n is the number of function type parameters)
This matches the Java extractor's behaviour.
2022-05-10 19:51:12 +01:00
Ian Lynagh
448b3d38d3 Kotlin: Duplicate less TRAP 2022-05-10 19:51:12 +01:00
Ian Lynagh
2f435a1a95 Kotlin: file_classes consistency check now passes 2022-05-10 19:51:12 +01:00
Ian Lynagh
368c330ecf Kotlin: Accept test changes following file-class fixes 2022-05-10 19:51:12 +01:00
Ian Lynagh
194e9fd2da Kotlin: Handle file classes better 2022-05-10 19:51:12 +01:00
Ian Lynagh
4340fe7044 Kotlin: Comments: Small refactoring 2022-05-10 19:51:12 +01:00
Tamas Vajk
b599ff2792 Change variable location extraction 2022-05-10 19:51:12 +01:00
Tamás Vajk
75e4b6c740 Fix typo in PrintAst.qll 2022-05-10 19:51:12 +01:00
Chris Smowton
33a9b4fb16 Add explanatory comment 2022-05-10 19:51:12 +01:00
Chris Smowton
e16a135a09 Add inner generic class test 2022-05-10 19:51:12 +01:00
Chris Smowton
0a4f97b151 Accept changes to standard library types
These are inner classes of the generic class java.lang.invoke.ClassSpecializer, whose generic parameters are no longer inappropriately attributed to its children.
2022-05-10 19:51:12 +01:00
Chris Smowton
997f818643 Accept java-and-kotlin result improvements
This happened because setting the type context for the return-type part of a function's label meant that the label now matches Java <-> Kotlin, and therefore it gets a Kotlin-source source location.
2022-05-10 19:51:12 +01:00
Chris Smowton
ab449e0517 Fix: use void as constructor return types in their labels
Without this we're incompatible with the Java extractor's constructor labelling
2022-05-10 19:51:12 +01:00
Chris Smowton
5188998bc6 Extract outer <-> inner class relationships for generic instances 2022-05-10 19:51:12 +01:00
Chris Smowton
67e3374a23 Fix inner generic type extraction
- Don't attribute type parameters that belong to the outer class to the inner
- Don't extract constructor generic parameters as if they were parameters of the type being instantiated
2022-05-10 19:51:12 +01:00
Tamas Vajk
aa0ddeb29a Fix external type locations in tests 2022-05-10 19:51:12 +01:00
Tamas Vajk
afd71a00d0 Fix extraction of function references without dispatch receiver 2022-05-10 19:51:12 +01:00
Tamas Vajk
ef2795c88b Add ktLocalFunction relation and tests for local and anonymous classes 2022-05-10 19:51:11 +01:00
Tamas Vajk
e0bf7d8246 Extract local class declarations 2022-05-10 19:51:11 +01:00
Tamas Vajk
1e64887903 Extract field receiver in field read/write 2022-05-10 19:51:11 +01:00
Tamas Vajk
10ae157682 Extract function references 2022-05-10 19:51:11 +01:00