Tianyu Geng
765cad8448
FIR checker: substitute type parameters in dispatch receiver type
...
Consider the following code:
```
fun test(a: List<String>) {
a.first()
}
```
The dispatch receiver type of `first` in this case is `List<T>` before
this change. After this change, it's `List<String>`.
In addition, this change also replace the dispatch receiver type with
the more specific type if available. For example, consider the following
```
class MyList: ArrayList<String>()
fun test(a: MyList) {
a.get(0)
}
```
The dispatch receiver type of `get` is `MyList`, instead of
`ArrayList<String>`. That is, a fake override is created in this case.
2021-09-17 01:59:06 +03:00
Dmitriy Novozhilov
5769d42248
[FIR] Fix all usages of annotations due to new FirAnnotation hierarchy
2021-09-13 13:53:12 +03:00
Mikhail Glukhikh
fc6403679a
Rename !USE_EXPERIMENTAL test directive to !OPT_IN
2021-09-10 16:29:16 +03:00
Tianyu Geng
c7272f6986
FIR checker: SENSELESS_(COMPARISON|NULL_IN_WHEN)
...
Currently DFA does not set "definitely equal to null" for access to variables that got assigned `null`. For example, FIR should mark the following line as SENSELESS_COMPARISON due to `s = null` above.
https://github.com/JetBrains/kotlin/blob/d1531f9cdd5852352c0133198706125dc63b6007/compiler/testData/diagnostics/tests/smartCasts/alwaysNull.fir.kt#L6
The problem is at https://github.com/JetBrains/kotlin/blob/7e9f27436a77de1c76e3705da7aa1fbe8938336b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/FirDataFlowAnalyzer.kt#L1104
For null assignment, ideally the type should be `Nothing?`. This is
addressed in a followup commit instead.
2021-08-06 22:57:16 +03:00
Dmitriy Novozhilov
0ab4770f02
[FIR] Add correctly reported diagnostics to testdata
2021-07-02 15:55:05 +03:00
Dmitriy Novozhilov
85b844c748
[FIR] Split FirAnonymousObject to expression and declaration
2021-06-29 21:03:27 +03:00
Igor Yakovlev
30c381f16d
[FIR] Fix invalid CallableId for methods in anonymous objects
2021-06-28 17:21:42 +03:00
Igor Yakovlev
ec80c21fd1
[FIR IDE] Fix lazy resolve for local declarations
2021-06-19 19:23:24 +02:00
Mikhail Glukhikh
ceb527c5e4
FIR: add OptIn checkers draft + some annotation / SinceKotlin utilities
2021-06-11 22:03:32 +03:00
Tianyu Geng
6a03f31e50
FIR: add UnsafeCall resolution diagnostics
...
Previously unsafe call is reported as part of InapplicableWrongReceiver.
This makes it difficult for the downstream checkers to report different
diagnostics.
2021-04-19 15:11:13 +03:00
Mikhail Glukhikh
43a2ad0467
FIR: don't flatten for loop blocks in raw FIR builder
2021-04-19 15:11:12 +03:00
Ilya Kirillov
0cf00d0f72
FIR: fix FirDefaultPropertyAccessor phase to BODY_RESOLVE
2021-04-15 15:23:56 +03:00
Mikhail Glukhikh
78fc87ffb1
FIR: apply minor test data fixes around type mismatch problems
2021-04-13 21:36:41 +03:00
vldf
57d2eb5da2
Introduce FirFunctionReturnTypeMismatchChecker
2021-04-13 21:36:33 +03:00
Dmitriy Novozhilov
5ebd24eac5
[FIR] Save inline status of lambda after resolution
2021-04-06 12:30:34 +03:00
Mikhail Glukhikh
798d848a91
FirReturnsImpliesAnalyzer: find receiver/variable of accessor properly
2021-03-17 12:13:21 +03:00
Jinseong Jeon
f1fa290d49
FIR checker: report val reassignment
2021-03-03 12:27:11 +03:00
Mikhail Glukhikh
34c90aab3b
FIR: introduce & use REFERENCE_BY_QUALIFIER positioning strategy
2021-02-19 18:24:46 +03:00
Jinseong Jeon
3d635b6a94
FIR: unwrap smartcast expression when extracting effects of contract
2021-02-11 17:02:16 +03:00
Mikhail Glukhikh
338aad98eb
FIR: run diagnostic "with stdlib" tests also in light tree mode
2021-01-29 16:55:34 +03:00
Mikhail Glukhikh
7d4eaefd36
FIR: report UNSAFE_CALL on dot when possible
2021-01-29 16:55:26 +03:00
Jinseong Jeon
e72ddbcbfe
FIR checker: differentiate UNSAFE_CALL from INAPPLICABLE_CANDIDATE
...
To do so, inside the root cause of inapplicable candidate errors,
we will record expected/actual type of receiver, if any.
That will help identifying inapplicable calls on nullable receiver.
2021-01-29 16:54:23 +03:00
Dmitriy Novozhilov
e6b5cb5216
[TD] Update diagnostics test data due to new test runners
...
Update includes:
- Changing syntax of `OI/`NI` tags from `<!NI;TAG!>` to `<!TAG{NI}!>`
- Fix some incorrect directives
- Change order of diagnostics in some places
- Remove ignored diagnostics from FIR test data (previously `DIAGNOSTICS` didn't work)
- Update FIR dumps in some places and add `FIR_IDENTICAL` if needed
- Replace all JAVAC_SKIP with SKIP_JAVAC directive
2020-12-16 19:52:25 +03:00
Denis Zharkov
65119adb6a
FIR: Adjust test data. FakeOverride -> SubssitutionOverride
2020-11-06 11:32:39 +03:00
Jinseong Jeon
1c1e8f7beb
FIR CFG: revise edge kind between local func node and fun enter node
...
so that local function enter node can be visited by FIR CFA
#KT-42814 Fixed
2020-10-21 14:01:31 +03:00
Dmitriy Novozhilov
f794ced888
[FIR] Fix incorrect cluster creating in CFG dumps
2020-10-12 11:55:05 +03:00
Dmitriy Novozhilov
68f3d84e22
[FIR] Use CandidateApplicability from FE 1.0
2020-09-09 12:38:34 +03:00
Arsen Nagdalian
ede1c08a9b
[FIR] Add resolution of contracts that are written using the new syntax
2020-08-25 12:58:39 +03:00
Dmitriy Novozhilov
316e0e6609
[FIR] Update testdata
2020-08-25 12:07:59 +03:00
Oleg Ivanov
21b8679799
[FIR] Add ReturnsImplies effect analyzer
2020-08-12 11:06:07 +03:00
Oleg Ivanov
4367d6631f
[FIR] Add CallsInPlace contract analyzer
2020-08-11 16:17:01 +03:00
Oleg Ivanov
cc9c5b9e3c
[FIR] Add CFG nodes, add multiple subGraphs for CFGOwner
2020-08-11 16:17:01 +03:00
Dmitriy Novozhilov
f283f2db43
[FIR] Improve diagnostic reporting & don't use error symbol for candidate if possible
...
Also introduce few new diagnostics:
- NONE_APPLICABLE more many inapplicable candidates
- HIDDEN for visible candidates
2020-07-28 20:46:56 +03:00
Dmitriy Novozhilov
bd8eaad885
[FIR-TEST] Update cfg dumps in some tests
...
One of previous commit changed order for those graphs, but i didn't
find which one
2020-06-19 15:53:11 +03:00
Dmitriy Novozhilov
26458875d5
[FIR] Add checker for uninitialized properties
2020-06-19 15:53:09 +03:00
Dmitriy Novozhilov
12ed8c3bb4
[FIR-TEST] Update CFG dumps according to new nodes order
2020-06-19 15:53:04 +03:00
Dmitriy Novozhilov
87859b0faa
[FIR] Introduce new algorithm for building CFG for declarations
2020-06-19 15:53:00 +03:00
Dmitriy Novozhilov
950bbfe3a5
[FIR] Add kind for back edges in CFG
2020-06-19 15:53:00 +03:00
Dmitriy Novozhilov
c71f9d9640
[FIR] Use argument mapping from resolved call for contract argument mapping
2020-04-15 11:13:01 +03:00
Dmitriy Novozhilov
a01bbbb0a0
[FIR] Add processing conditional contracts on property accessors
2020-04-15 11:13:00 +03:00
Dmitriy Novozhilov
1074e4bf29
[FIR] Add contracts resolve for property accessors
2020-04-15 11:13:00 +03:00
Dmitriy Novozhilov
d808f3e4fb
[FIR-TEST] Add tests for contracts resolve
2020-04-15 11:12:59 +03:00