Chris Smowton
7dec3f4835
Use EqualityTest for either value or ref comparions, and ReferenceEqualityTest for strictly ref comparison.
2022-05-10 19:51:17 +01:00
Chris Smowton
f95effcf82
Always extract ValueEQ/NEExpr for Kotlin ==/!=
...
I introduce AnyEqualsExpr for either reference or value equality and AnyEqualityTest for the same concept including not-equals operators, and use them wherever the written QL clearly doesn't care about the difference between reference and value comparison, typically because it is concerned with testing against null or against a primitive constant.
2022-05-10 19:51:17 +01:00
Chris Smowton
a120fab9f7
Complete implementation of equality tests
...
- Create a new operator representing an infix value [in]equality test, equivalent to Objects.equals(lhs, rhs)
- Continue to use simple equality where it is clearly possible at the callsite
- Note that ieee754equals is the same as Java's == and != operators
2022-05-10 19:51:17 +01:00
Ian Lynagh
458cb850a7
Kotlin: Accept test changes
2022-05-10 19:51:16 +01:00
Chris Smowton
377bd8f2e9
Extract String?.plus as either an AddExpr or a call to an intrinsic
...
If it is used by the compiler to implement the infix plus operator, resugar it and extract a `+` as Java would. If it is literally called by the user (e.g. `(if (x) then "not null" else null).plus(something)`), then extract a call to the real method Intrinsics.stringPlus (a two-arg static method).
2022-05-10 19:51:16 +01:00
Chris Smowton
93e8d5a2d6
Add tests for mutually-recursive types
2022-05-10 19:51:16 +01:00
Chris Smowton
8bb23651ae
Extract type parameter bounds
2022-05-10 19:51:16 +01:00
Tamas Vajk
2965e780cc
Add local dataflow test for string templates
2022-05-10 19:51:16 +01:00
Tony Torralba
6bd6097ed1
Add taint step for StringTemplateExpr
2022-05-10 19:51:16 +01:00
Tamas Vajk
d495badc1e
Rename companion object QL class
2022-05-10 19:51:16 +01:00
Tamas Vajk
4adf5829e4
Fix expected files
2022-05-10 19:51:16 +01:00
Tamas Vajk
b4beddf2f9
Introduce cast for <unsafe-coerce> calls
2022-05-10 19:51:15 +01:00
Ian Lynagh
8d754f5129
Kotlin: Fix bug in, and performance of, NullGuards::clearlyNotNullExpr
2022-05-10 19:51:15 +01:00
Ian Lynagh
03c1845053
Kotlin: Add a TODO comment
2022-05-10 19:51:15 +01:00
Ian Lynagh
76ca0b2776
Kotlin: Pull Kotlin type for localvars out into its own table
2022-05-10 19:51:15 +01:00
Ian Lynagh
7862229807
Kotlin: Pull Kotlin type for params out into its own table
2022-05-10 19:51:15 +01:00
Ian Lynagh
dc26abe341
Kotlin: Pull Kotlin type for methods/constrs out into their own tables
2022-05-10 19:51:15 +01:00
Ian Lynagh
ee008773dc
Kotlin: Pull Kotlin type for fields out into its own table
2022-05-10 19:51:15 +01:00
Ian Lynagh
0f7f90dd4e
Kotlin: Add a consistency query for Kotlin types
2022-05-10 19:51:15 +01:00
Ian Lynagh
86bf126ed8
Kotlin: Pull Kotlin type for expressions out into its own table
2022-05-10 19:51:15 +01:00
Tamas Vajk
cd5555a5dd
Extract companion objects from interfaces
2022-05-10 19:51:15 +01:00
Chris Smowton
4d408159aa
When extracting a call to an inherited method, substitute the callee's type parameters appropriately.
2022-05-10 19:51:15 +01:00
Ian Lynagh
89eae2407b
Kotlin: Improve error handling
...
Each compilation, and each file within a cmopilation, now gets a
"result" indicating whether it had recoverable or non-recoverable
errors.
2022-05-10 19:51:15 +01:00
Ian Lynagh
46ccd45833
Kotlin: Add tests for fake overrides
2022-05-10 19:51:15 +01:00
Chris Smowton
27b0d579d0
Add compilation-units test
2022-05-10 19:51:14 +01:00
Chris Smowton
024f8c651e
Accept test changes
2022-05-10 19:51:14 +01:00
Chris Smowton
863037ec41
Always extract methods of user-class supertypes
...
This matches the Java extractor's behaviour. Also if we re-visit a class to extract its members, revisit its supertypes to extract their members too.
2022-05-10 19:51:14 +01:00
Tamas Vajk
8f48c1b161
Add test for missing generic method
2022-05-10 19:51:14 +01:00
Chris Smowton
20d56094ee
Note that unusedLocation can raise an alert for used but inaccessible locations
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
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
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
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
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
Tamás Vajk
75e4b6c740
Fix typo in PrintAst.qll
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
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