Commit Graph

6146 Commits

Author SHA1 Message Date
Kevin Bourrillion 2694bdeb92 Change to use new JSpecify package location. 2022-12-27 11:10:59 +00:00
Kevin Bourrillion 671480ce1a Duplicate this entire test suite to jspecifyOld before changing the package locations in jspecify. 2022-12-27 11:10:59 +00:00
Ilya Gorbunov e2d96da396 Introduce experimental kotlin.concurrent.Volatile annotation KT-55268, KT-55609
Use this annotation in tests to ensure it works the same at least on JVM
2022-12-23 19:07:30 +01:00
Anna Kozlova 15b1e429d7 [compiler] introduce dedicated Fir declaration for dangling modifier lists (KTIJ-23008)
ensure fir annotations are included in FirDanglingModifierList and resolved,
dedicated DanglingTopLevelModifierListStructureElement exists for top
level lists only, class level lists are processed by containing structure
element
2022-12-21 20:58:46 +00:00
Evgeniy.Zhelenskiy ac28c0a286 [IR] Allow inline modifier for functions returning MFVC without warning
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-12-20 21:26:56 +00:00
Pavel Kunyavskiy 4928e284f6 Make LateinitIntrinsicApplicabilityChecker warning for Native and JS
This checker was enabled only on JVM by mistake.
It's now fixed, but we don't want to make it an error in minor release.
So it will be an warning in 1.8.20 and an error in 1.9.0

^KT-27002
2022-12-20 20:06:52 +00:00
Dmitriy Novozhilov 02e327277e [FIR] Report VAL_REASSIGNMENT on assign to non-local vals
In this commit reporting on member properties in init section of class
  is not supported (see KT-55528)

^KT-55493 Fixed
2022-12-20 08:12:09 +00:00
Dmitriy Novozhilov e87a064cdd [FIR] Report VARIABLE_EXPECTED on assign to this 2022-12-20 08:12:09 +00:00
Dmitriy Novozhilov b174bb8844 [FIR] Update testdata after introducing FirResolvedErrorReference 2022-12-15 12:12:19 +00:00
Steven Schäfer 6af616d3c3 FIR: make declarations marked with 'override' implicitly open
#KT-52236 Fixed
2022-12-14 21:46:41 +00:00
Mikhail Glukhikh 6111daa8f7 Fix a pair of broken lazy resolve tests after rebase 2022-12-12 17:27:19 +01:00
Ilya Kirillov 644d1bf0d0 [FIR] ignore tests which fail because of resolve contracts violation 2022-12-12 16:21:07 +00:00
Denis.Zharkov cd0d6d2773 Adjust test data for postponing ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated
^KT-55357 Related
^KT-36770 Related
2022-12-12 11:39:04 +00:00
Pavel Mikhailovskii 08767d572b KT-51247 Fix resolution of functional types with context receivers 2022-12-09 15:29:39 +00:00
Dmitriy Novozhilov bd3a28d04d [FE 1.0] Report INTEGER_OPERATOR_RESOLVE_WILL_CHANGE in missing cases
Covered places:
- local properties
- vars
- return positions of functions and lambdas

^KT-45970 Fixed
^KT-55358 Fixed
2022-12-09 15:10:03 +00:00
Dmitriy Novozhilov a979960e63 [FE 1.0] Add test for KT-45970 2022-12-09 15:10:02 +00:00
Dmitriy Novozhilov 3cffb33ab7 [FE] Drop ApproximateIntegerLiteralTypesInReceiverPosition language feature
This feature is not needed because it is unconditionally disabled for K1
  (because of not fully correct implementation) and unconditionally enabled
  in K2 (K2 does not support old behavior)

^KT-38895
2022-12-09 15:10:02 +00:00
Mikhail Glukhikh 758a4931e3 EmptyIntersectionTypeChecker: drop also incompatible supertypes check
Incompatible supertypes check also don't provoke runtime problems
in most situations, because this check is also bound to type argument
conflict. Related to KT-54411
2022-12-09 15:00:41 +00:00
Mikhail Glukhikh 2a1a5c6936 EmptyIntersectionTypeChecker: drop questionable check of arguments
The situations with conflicting type arguments normally don't provoke
any runtime problems. Also, conflicts like A<T> VS A<SomeType> aren't
valid at all. Here we decided to remove them to avoid strange
and non-actionable warnings in user code.

#KT-54411 Fixed
2022-12-09 15:00:40 +00:00
Mikhail Glukhikh 832baf81e5 EmptyIntersectionTypeChecker: fix error in diagnostic text
Related to KT-54411
2022-12-09 15:00:39 +00:00
Mikhail Glukhikh d5c8d9fecc FE: add test reproducing KT-54411 2022-12-09 15:00:38 +00:00
Dmitriy Novozhilov d898e256ca [FIR] Don't update explicit delegated constructor calls of classes with @JvmRecord
^KT-54573 Fixed
2022-12-09 12:02:08 +00:00
Dmitriy Novozhilov f3da26946b [FIR] Change priority of K2_VISIBILITY_ERROR CandidateApplicability
In K1 analogue of `K2_VISIBILITY_ERROR` is `K1_RUNTIME_ERROR`, so
  candidates with `K2_VISIBILITY_ERROR` should win over innaplicable
  candidates with `INAPPLICABLE`, `INAPPLICABLE_ARGUMENTS_MAPPING_ERROR`
  or `INAPPLICABLE_WRONG_RECEIVER` applicability

This is needed to allow resolution to invisible symbols (and later
  suppress error with `@Suppress("INVISIBLE_SYMBOL", "INVISIBLE_REFERENCE")`

^KT-55026 Fixed
^KT-55234
2022-12-09 12:02:05 +00:00
Dmitriy Novozhilov 44fd9ddf85 [Test] Add test for KT-55338 2022-12-08 10:19:36 +00:00
pyos a3768b9185 FIR DFA: don't propagate reassignments of loop-scoped vars to outside 2022-12-08 10:19:36 +00:00
pyos 402ea98e02 FIR DFA: align FirLocalVariableAssignmentAnalyzer with the graph builder
I.e. maintain a set of seen lambdas where each marked as either "data
flow only" or "both data and control flow". The latter are truly
parallel with the function being analyzed, while the former have
technically already terminated, we just don't know the types inside them
because they may not have been analyzed yet.
2022-12-08 10:19:34 +00:00
pyos f485413cfd FIR DFA: x !is T? => x != null
^KT-22996 tag fixed-in-k2
2022-12-08 10:19:27 +00:00
pyos 02fedeb9ed FIR DFA: revalidate reassigned variables after loops
If a certain type statement is true on loop entry and all continue
paths, then it is also true on exit if the condition did not reassign
the variable.

^KT-7676 tag fixed-in-k2
2022-12-08 10:19:27 +00:00
pyos f9745bd3f1 FIR DFA: make continue jump to condition entry, not loop entry
It's also not a backwards jump in do-while, unless it's in the loop's
condition, which is a stupid "feature" IMO. As you can probably tell
from the comments added in this commit.
2022-12-08 10:19:26 +00:00
pyos 0d46dfc1ba FIR: fix substitution of type arguments in SAM type aliases
^KT-54730 Fixed
2022-12-07 22:09:20 +00:00
Pavel Mikhailovskii f96d41e414 KT-4107 Don't generate readResolve for data objects 2022-11-30 21:07:20 +00:00
Evgeniy.Zhelenskiy fa4a4e56f3 [Tests] Remove unnecessary usages of OPTIONAL_JVM_INLINE_ANNOTATION
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:42 +00:00
Evgeniy.Zhelenskiy 38c80192f9 [IR] Support MFVC-typed properties and interfaces delegates
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:40 +00:00
Evgeniy.Zhelenskiy fa4ceb4ef4 [IR] Add diagnostics to forbid annotations for MFVC-typed elements
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:39 +00:00
Evgeniy.Zhelenskiy adee33d3e5 [IR] Forbid MFVC primary constructors default arguments
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:38 +00:00
Evgeniy.Zhelenskiy 9f01ccc304 [IR] Support user-defined equals for MFVC
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:36 +00:00
Evgeniy.Zhelenskiy 6107caa8e2 [FE1.0, FIR] Support secondary constructors for Value Classes
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:35 +00:00
Evgeniy.Zhelenskiy 0c70b60988 [IR] Add context receiver test on MFVC
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:33 +00:00
Yan Zhulanow 10fc86ef92 [FE] Add tests for 'containingClassForStaticMemberAttr' 2022-11-30 04:12:28 +00:00
Yan Zhulanow 0e050ae7f1 [FE] Consider derived class tag on caching substitution scopes 2022-11-30 04:12:27 +00:00
Marco Pennekamp d4e6a4ad54 [FIR] KT-54978 Prohibit explicit type arguments in property accesses
- Add a checker which ensures that property accesses have no explicit
  type arguments. If an error on the property access's callee reference
  already exists, the new error is not reported in favor of the existing
  error, as the property access may have been intended to be a function
  call.
- `complicatedLTGT.fir.kt`: The underlying parser issue is not yet
  solved, which is why `x` is parsed as a property access with explicit
  type arguments.
- `reservedExpressionSyntax` tests: This new check makes a lot of the
  access expressions in these tests illegal, so valid lines have been
  added and invalid lines appropriately marked with
  `EXPLICIT_TYPE_ARGUMENTS_IN_PROPERTY_ACCESS` errors.

^KT-54978 fixed
2022-11-29 14:47:59 +00:00
Dmitriy Novozhilov 46928eaa0b [FIR] Unconditionally enable BooleanElvisBoundSmartCasts feature in K2
^KT-54694 Fixed
^KT-26357
2022-11-29 12:25:45 +00:00
Dmitriy Novozhilov ac7fddaad5 [FE] Always infer upper types to intersection types in K2...
...and always use old algorithm for K1

^KT-51221
2022-11-29 12:25:44 +00:00
Ilya Chernikov 47448d779c K2 Scripting: enable script diagnostic tests for FIR
also add script scopes test
2022-11-26 18:01:49 +00:00
Evgeniy.Zhelenskiy 002f6bd34a [FIR] Fix JvmName annotation diagnostics
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-55143
2022-11-25 16:30:22 +01:00
Nikolay Lunyak a454d42e65 [FIR] KT-54587: Report the missing diagnostics
^KT-54587 Fixed

Merge-request: KT-MR-7791
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2022-11-25 10:19:58 +00:00
Vladislav Grechko cd6e865fb3 Improve support of 'lateinit' modifier
- Allow 'lateinit' for inline classes which underlying type
is suitable for 'lateinit'

- K2: report all problems related to 'lateinit' modifier

^KT-55052: Fixed
2022-11-24 19:47:21 +00:00
Denis.Zharkov ca12cfb90d K2: Do not fix variables that has yet unprocessed constraints in forks
Otherwise, exception from org.jetbrains.kotlin.resolve.calls.inference.components.ConstraintInjector.TypeCheckerStateForConstraintInjector.fixedTypeVariable
might happen during forks resolution

The test data is extracted from intelliJ FP test

^KT-43296 Fixed
2022-11-24 17:29:30 +00:00
Denis.Zharkov b73acd7a3a K2: Apply constraints from forks at UNTIL_FIRST_LAMBDA completion phase
Otherwise, OVERLOAD_RESOLUTION_AMBIGUITY is reported for the calls to
the functions annotated as @OverloadResolutionByLambdaReturnType

^KT-43296 In Progress
2022-11-24 17:29:29 +00:00
Denis.Zharkov 10d63cc52a K2: Postpone inference forks resolution until FULL completion
It helps to use expected type information when choosing the branch
even in the nested calls

^KT-43296 In Progress
2022-11-24 17:29:29 +00:00