Commit Graph

210 Commits

Author SHA1 Message Date
Ivan Kylchik b131c52889 Drop all usages of WITH_RUNTIME directive 2021-12-13 18:07:11 +03:00
Ivan Kochurkin 9f8387c76a [FIR] Fix 1.(fun Int.() = 1)() call fir conversion 2021-12-09 12:31:23 +00:00
Anastasiya Shadrina 4d3035e2f7 [Parser] Do not support local contextual declarations 2021-12-03 20:22:17 +03:00
Anastasiya Shadrina 2d088196ce [FE] Fill DESCRIPTOR_TO_CONTEXT_RECEIVER_MAP only with CR enabled 2021-12-02 20:25:06 +03:00
Anastasiya Shadrina 9e2271399e [FE] Render context receivers for functions, properties, and classes 2021-12-02 20:25:05 +03:00
Anastasiya Shadrina 2b30c1eb5d [FE] Do not change original semantics in LabelResolver 2021-12-02 20:25:00 +03:00
Anastasiya Shadrina 5d76f979cf [Tests] Minor: add FIR_IDENTICAL to typeParameterAsContextReceiver.kt 2021-12-02 20:24:59 +03:00
Anastasiya Shadrina a70036c945 [Tests] Add a test with type parameter as a context receiver 2021-12-02 20:24:58 +03:00
Anastasiya Shadrina 752bc299f1 [FE, Tests] Passing context(A, B) where context(B, A) expected 2021-12-02 20:24:56 +03:00
Anastasiya Shadrina ac27fda965 [FE] Report ambiguity when label can refer to multiple receivers 2021-12-02 20:24:44 +03:00
Anastasiya Shadrina 7ab9b68ad5 [FE] Move type-related checks to TypeResolver 2021-12-02 20:24:41 +03:00
Anastasiya Shadrina c59ed6344e [Tests] Make build green again 2021-12-02 20:24:31 +03:00
Anastasiya Shadrina b3591e77be [FE] Prohibit explicit @ContextFunctionTypeParams usage 2021-12-02 20:24:20 +03:00
Anastasiya Shadrina a091b345a0 [FE] Provide overloadability for candidates with different CR 2021-12-02 20:24:19 +03:00
Anastasiya Shadrina 910660a083 [FE] Add language feature for context receivers 2021-12-02 20:24:16 +03:00
Anastasiya Shadrina 369c86ebb0 [FE] Fix contextual functional types rendering 2021-12-02 20:24:16 +03:00
Anastasiya Shadrina 7fce2691e2 [FE] Allow lambda argument cast to contextual functional type 2021-12-02 20:24:15 +03:00
Anastasiya Shadrina d8faa9686d [Tests] Test samples from KEEP 2021-12-02 20:24:14 +03:00
Anastasiya Shadrina b0a7be72e8 [Tests] Add missing and fix incorrect 2021-12-02 20:24:13 +03:00
Anastasiya Shadrina 16b976f0e0 [FE] Support functional literals with context receivers 2021-12-02 20:24:11 +03:00
Anastasiya Shadrina e3f987459c [PSI, FE] Support functional types 2021-12-02 20:24:11 +03:00
Anastasiya Shadrina e53cee77a3 [FE] Support multiple candidates for extension receiver 2021-12-02 20:24:10 +03:00
Anastasiya Shadrina f9e6365461 [Tests] Make build green again 2021-12-02 20:24:07 +03:00
Anastasiya Shadrina f427265739 [FE] Resolve overload conflict between contextual and non-contextual declarations 2021-12-02 20:24:03 +03:00
Anastasiya Shadrina 7fd5034cd6 [FE] Minor: fix typo 2021-12-02 20:24:01 +03:00
Anastasiya Shadrina 2d743a2455 [FE] Add case with ambiguous generic call 2021-12-02 20:24:01 +03:00
Anastasiya Shadrina 814777ba8c [FE] Report ambiguity in all possible cases 2021-12-02 20:23:58 +03:00
Anastasiya Shadrina 37495bcba0 [FE] Change resolution scheme 2021-12-02 20:23:57 +03:00
Anastasiya Shadrina 1f6746dc74 [FE] Relax the "no subtyping between context receivers" limitation 2021-12-02 20:23:56 +03:00
Anastasiya Shadrina bfd20e1890 [FE] Move context receivers checks to the separate resolution part 2021-12-02 20:23:56 +03:00
Anastasiya Shadrina 875f4ea31c [FE] Support local contextual declarations 2021-12-02 20:23:54 +03:00
Anastasiya Shadrina 1a0aab4a44 [FE] Inline classes cannot have context receivers 2021-12-02 20:23:52 +03:00
Anastasiya Shadrina d704862582 [FE] Prohibit property initializers with context receivers 2021-12-02 20:23:51 +03:00
Anastasiya Shadrina 5e426d5c16 [Parser] Continue parsing if context receiver is not parsed correctly 2021-12-02 20:23:48 +03:00
Anastasiya Shadrina 1bcaeabd84 [PSI, FE, PSI2IR] Use labels for referencing specific receiver 2021-12-02 20:23:40 +03:00
Anastasiya Shadrina f4ddf66ac4 [FE] Support context receivers on classes 2021-12-02 20:23:25 +03:00
Anastasiya Shadrina c34fe8d547 [FE] Implement temporary resolution algorithm 2021-12-02 20:23:24 +03:00
Anastasiya Shadrina d923c95671 [FE] Add context receivers to scope 2021-12-02 20:23:22 +03:00
Dmitriy Novozhilov f26059a7d3 [FE] Add clear warning about future changes about nullability of safe call with non nullable receiver
^KT-46860
2021-10-27 16:28:37 +03:00
Ivan Kochurkin 84c5f58cab [FIR] Implement UNRESOLVED_REFERENCE_WRONG_RECEIVER 2021-08-25 21:53:23 +00:00
Ivan Kochurkin 2574dc907c [FIR] Implement FUNCTION_EXPECTED 2021-07-28 23:17:31 +03:00
Denis.Zharkov ddbdfafa79 Remove OI/NI attributes from test data 2021-05-25 13:28:27 +03:00
Denis.Zharkov 2ecba6ac39 Remove WITH_NEW_INFERENCE directive from all tests
This directive anyway does not make test run twice with OI, and with NI
It only once run the test with specific settings (// LANGUAGE)
and ignores irrelevant (OI or NI tags)
2021-05-25 13:28:26 +03:00
Denis.Zharkov 00821bbc63 FIR: Update test data (repeated diagnostics)
They are a bit redundant, but it needs additional work to be done
to avoid them
2021-05-20 17:24:33 +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
Ivan Kochurkin ad9b962536 [FIR] Fix tests (ARGUMENT_TYPE_MISMATCH instead of INCOMPATIBLE_CANDIDATE) 2021-04-12 23:49:55 +03:00
Jinseong Jeon 5a0b75bd89 FIR checker: warn unnecessary safe calls 2021-04-09 12:32:45 +03:00
Tianyu Geng 761a0a7d0d FIR checkers: report specific errors instead of INAPPLICABLE_CANDIDATE
Specifically, the report the following 4 errors.

* NON_VARARG_SPREAD
* ARGUMENT_PASSED_TWICE
* TOO_MANY_ARGUMENTS
* NO_VALUE_FOR_PARAMETER

Also added/updated the following position strategies.
* NAME_OF_NAMED_ARGUMENT
* VALUE_ARGUMENTS
2021-04-02 14:36:14 +03:00
Dmitriy Novozhilov cd890d5833 [Test] Disable UNUSED_* diagnostics in tests which are not belong to contolFlowAnalysis suite 2021-03-29 16:12:29 +03:00
Tianyu Geng d6907222cd FIR: pass the qualified access source when reporting ErrorNamedReference
Currently if there is an error in a function call, FIR would report the
entire expression if this call is qualified, but *only* the name if it's
not qualified. For example, assume the following two calls are all
contains some errors.

```
a.foo(1,2,3)
^^^^^^^^^^^^
bar(1,2,3)
^^^
```

The entire call of `foo` is reported since it's qualified. But only the
reference `bar` is reported since it's not qualified. This limits the
usage of position strategies because the IDE does not allow position
strategies to go outside of the initially reported PSI element
(org.jetbrains.kotlin.idea.fir.highlighter.KotlinHighLevelDiagnosticHighlightingPass#addDiagnostic).

This change passes both the original error named reference and the
surrounding qualified access expression and defer the decision of which
to use to the reporting logic.

For unresolved reference and checks on `super` keyword, the position
strategy should not highlight the surrounding parentheses. Hence a new
position strategy `REFERENCED_NAME_BY_QUALIFIED` is added.

In addition, this change also has the following side effect

* some diagnostics are no longer reported when there is a syntax error
  since the higher level structure does not exist when there is a syntax
  error
2021-03-29 12:45:27 +03:00