Commit Graph

46 Commits

Author SHA1 Message Date
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
Mikhail Glukhikh 3febabe977 Use OPT_IN instead of EXPERIMENTAL in diagnostic names 2021-09-10 16:29:13 +03:00
Denis.Zharkov 112af9b145 FIR: Rework bare types support
^KT-48305 Fixed
2021-08-30 16:24:44 +03:00
Dmitriy Novozhilov 0924216ed2 [FIR] Distinguish stub types for builder inference and for subtyping
^KT-48110 Fixed
2021-08-26 10:08:52 +03:00
Mikhail Glukhikh 82f268d611 FIR: add EXPERIMENTAL_API_USAGE reporting 2021-07-23 23:58:55 +03:00
Dmitriy Novozhilov f400477c70 [FIR] Remove generic parameter from FirDeclaration 2021-06-29 21:03:30 +03:00
Igor Yakovlev 30c381f16d [FIR] Fix invalid CallableId for methods in anonymous objects 2021-06-28 17:21:42 +03:00
Ivan Kochurkin 66e2b44272 [FIR] Implement UPPER_BOUND_VIOLATED_IN_TYPEALIAS_EXPANSION diagnostics, fix handling of UPPER_BOUND_VIOLATED 2021-06-25 20:57:46 +03:00
Ilya Kirillov 72b8593240 FIR IDE: do not use IJ test infrastructure in frontend-api-fir tests 2021-06-20 22:07:31 +02:00
Igor Yakovlev ec80c21fd1 [FIR IDE] Fix lazy resolve for local declarations 2021-06-19 19:23:24 +02:00
Denis.Zharkov 592256976e FIR: Fix inference of builder-inference function from expect type
Previously, such calls were being completed with FULL mode and incorrect
INFERENCE_NO_INFORMATION_FOR_PARAMETER has been reported
2021-06-07 15:25:57 +03:00
Ivan Kochurkin c4c2fbb5a0 [FIR] Implement RECURSIVE_TYPEALIAS_EXPANSION, CYCLIC_INHERITANCE_HIERARCHY diagnostics, fix stackoverlow exception in case if typealias points to type with type arguments 2021-06-03 20:41:58 +03:00
Victor Petukhov 758eb8f851 Fix builder inference tests 2021-05-28 15:36:22 +03:00
Denis.Zharkov 829f80179c FIR: Update rendered tree in test data 2021-05-20 17:24:29 +03:00
Mikhail Glukhikh 05872fc6a8 Support captured types in ConeTypeCompatibilityChecker 2021-05-07 17:06:34 +03:00
Jinseong Jeon e2dc21da90 FIR checker: warn useless as and is 2021-05-05 18:20:51 +03:00
Ilya Kirillov 09a94f3200 FIR IDE: ignore non-passing tests in compiler based tests 2021-05-04 08:19:49 +02:00
Mikhail Glukhikh 43a2ad0467 FIR: don't flatten for loop blocks in raw FIR builder 2021-04-19 15:11:12 +03:00
Mikhail Glukhikh b58e5b182c FIR: add test fixing builder inference case 2021-04-13 21:36:38 +03:00
Jinseong Jeon 2ecb6733ed FIR checker: warn unnecessary non-null assertions 2021-04-09 12:32:45 +03:00
Dmitriy Novozhilov 5ebd24eac5 [FIR] Save inline status of lambda after resolution 2021-04-06 12:30:34 +03:00
Ilya Chernikov ed78183dbd FIR: use more specific cone error for unresolved user type ref
replaces diagnostic with <No name> with specific qualifier
2021-03-24 21:24:18 +01:00
Mikhail Glukhikh 9ae41f5c07 FIR: store substitution for properties with implicit return type 2021-03-24 16:07:21 +03:00
Mikhail Glukhikh 4768700600 FIR error repro: property type mismatch in override from light classes 2021-03-24 16:07:20 +03:00
Dmitriy Novozhilov dceb8b2991 [FIR] Don't render ! at the end of ConeFlexibleType 2021-03-11 13:10:05 +03:00
Mikhail Glukhikh 34c90aab3b FIR: introduce & use REFERENCE_BY_QUALIFIER positioning strategy 2021-02-19 18:24:46 +03:00
Mikhail Glukhikh 21000f4174 [FIR] Support TypeVariableMarker.isReified 2021-02-02 16:25:08 +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 9a5791ad6d FIR: use correct context for enum entry resolve
Now the same resolve context is used for enum entries and
for constructors.
2021-01-18 08:34:46 +03:00
Mikhail Glukhikh f85fc47383 FIR: introduce separate companion object resolve context
Before this commit, during the resolve of companion objects we used
the same context than for any nested class. However, during companion
object resolve we should not have companion object receiver itself
accessible in any case (in particular, it should not be accessible
in constructor). So in this commit we introduced separate context
for this purpose.
2021-01-18 08:32:06 +03:00
Mikhail Glukhikh a6534c4653 [FIR] Fix completion of synthetic call arguments 2020-12-29 17:48:15 +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
Mikhail Glukhikh 42ea4463ee Fix type argument inconsistency in FirResolvedQualifier 2020-12-09 19:53:24 +03:00
Denis Zharkov 65119adb6a FIR: Adjust test data. FakeOverride -> SubssitutionOverride 2020-11-06 11:32:39 +03:00
Mikhail Glukhikh 7f3d0af4f7 [FIR Java] Soften rules for matching types for may-be-special-builtins
This commit is workaround for cases like
MyJavaMap<KK : Bound, V> : java.util.Map<K, V>.
After signature changing and substitution we have
MyJavaMap.get(Object) declared and MyJavaMap.get(KK) from supertype,
which can't be otherwise matched as overriding one another.
2020-10-23 08:12:16 +03:00
Mikhail Glukhikh 548adc29d0 [FIR] Enter loops in resolve using independent context 2020-09-03 14:24:31 +03:00
Mikhail Glukhikh 6eab6f2f87 [FIR TEST] Replace OTHER_ERROR with UNRESOLVED_REFERENCE in test data 2020-08-02 18:19:47 +03:00
Mikhail Glukhikh ceaffb1e8b [FIR] Don't report duplicated errors in implicit primary constructors 2020-08-02 18:19:45 +03:00
Mikhail Glukhikh 0804c6a0f3 [FIR] Introduce TYPE_ARGUMENTS_NOT_ALLOWED & some other type errors
This commit introduces several different things, in particular:
- check type arguments in expressions
- new TypeArgumentList node to deal with diagnostic source
- ConeDiagnostic was moved to fir:cones
- ConeIntermediateDiagnostic to use in inference (?) without reporting
- detailed diagnostics on error type
2020-08-02 18:19:44 +03:00
Denis Zharkov 477e8bbcd4 FIR: Add test case for qualifier-based call resolution 2020-04-21 09:52:52 +03:00
Mikhail Glukhikh fe02c2bab3 FIR: return Unit from empty lambda 2020-04-20 17:05:34 +03:00
Denis Zharkov 168c7f306f FIR: Fix ambiguity for invoke candidates on qualifier receiver 2020-04-07 17:54:55 +03:00
Denis Zharkov 6cc6b9efcb FIR: Fix overload resolution for some invoke cases
Namely, it's about the cases when there are multiple variable candidates
with the same priority and all of them should be collected and compared
2020-04-02 12:10:50 +03:00
Dmitriy Novozhilov 48fb279721 [FIR] Add constraint to flexible type for declared argument for java parameter 2020-03-27 10:17:12 +03:00
simon.ogorodnik 5a3eefcba1 [FIR] Fix suspend functional type deserialization 2020-03-24 18:58:17 +03:00
Dmitriy Novozhilov cc07ae96b3 [FIR-TEST] Move analysis tests to separate module 2020-03-19 09:51:01 +03:00