Commit Graph

1359 Commits

Author SHA1 Message Date
Nikolay Lunyak 425d5e808b [FIR] Link some tests with issues
Just in case.

^KT-59874
2023-11-14 15:19:33 +00:00
Nikolay Lunyak 41c5934d4e [FIR] Don't forget to ignore hidden imports
^KT-59874
2023-11-14 15:19:33 +00:00
Nikolay Lunyak c656a83a02 [FIR] Don't miss non-const annotation args
This code with `b()` crashes the JVM
backend.

^KT-59822 Fixed
^KT-59874
2023-11-14 15:19:33 +00:00
Mikhail Glukhikh 9903b70e0a K2: add test to confirm KT-58874 now works properly
#KT-58874 Obsolete
2023-11-13 12:26:28 +00:00
Kirill Rakhman d91000e39c [FIR] Report INAPPLICABLE_CANDIDATE or more specific diagnostic for callable references
... instead of just UNRESOLVED_REFERENCE when something went wrong
during resolution.

#KT-59401 related
2023-11-08 15:45:48 +00:00
Anastasia.Nekrasova 93ebd83ecd [K2] Disappeared OPT_IN_MARKER_CAN_ONLY_BE_USED_AS_ANNOTATION_OR_ARGUMENT_IN_OPT_IN (4)
Added checking usages of markers as qualifiers in properties and function calls.

^KT-59998
2023-11-07 13:12:46 +00:00
Anastasia.Nekrasova 72d69e16c4 [K2] Disappeared OPT_IN_MARKER_CAN_ONLY_BE_USED_AS_ANNOTATION_OR_ARGUMENT_IN_OPT_IN (3)
Added checking usages of markers as qualifiers in imports.

^KT-59998
2023-11-07 13:12:46 +00:00
Anastasia.Nekrasova 97f09acc92 [K2] Disappeared OPT_IN_MARKER_CAN_ONLY_BE_USED_AS_ANNOTATION_OR_ARGUMENT_IN_OPT_IN (2)
Added checking usages of markers as qualifiers.

KT-59998
2023-11-07 13:12:46 +00:00
Anastasia.Nekrasova 445ed7abc9 [K2] Disappeared OPT_IN_MARKER_CAN_ONLY_BE_USED_AS_ANNOTATION_OR_ARGUMENT_IN_OPT_IN (1)
Added error propagation for the type-aliased type.

^KT-59998
2023-11-07 13:12:46 +00:00
Dmitriy Novozhilov c5d1c4e816 [Test] Add test for KT-62137 2023-11-06 15:24:39 +00:00
Brian Norman 3327bed5bd [FIR] Report more occurrences of NON_LOCAL_RETURN_NOT_ALLOWED
When an inline lambda is invoked or passed to another inline function,
make sure non-local returns are allowed by all surrounding declarations.
Otherwise, NON_LOCAL_RETURN_NOT_ALLOWED must be reported.

^KT-59884 Fixed
^KT-55319 Fixed
2023-11-02 12:33:56 +00:00
Nikolay Lunyak f5d859f209 [FIR] Don't miss smartcast info on equalities with when subjects
Since they are not `FirSmartCastExpression`s,
they are treated as proper original types,
thus leading to reporting errors instead of
warnings.

^KT-60095 Fixed
2023-10-31 10:40:43 +00:00
Nikolay Lunyak ed8935899c [FIR] Relax incompatibleEnumAndUnrelatedInterface 2023-10-30 06:58:40 +00:00
Nikolay Lunyak 8ec7d128f5 [FIR] Add one more missed case 2023-10-30 06:58:40 +00:00
Nikolay Lunyak c6bec2fa75 [FIR] Relax incompatibleEnumAndUnrelatedInterfaceThroughTypeParameter 2023-10-30 06:58:40 +00:00
Nikolay Lunyak 3058f2eaff [FIR] Relax incompatibleEnumComparisonWithTypeParameters 2023-10-30 06:58:40 +00:00
Nikolay Lunyak ae521524d6 [FIR] Add tests highlighting false errors in K2 regarding equalities
Some overlooked corner-cases found by Denis.
2023-10-30 06:58:39 +00:00
Dmitrii Gridin 2f8026f335 [LL FIR] add missed diagnostic tests for scripts
^KT-62840
^KT-62841
^KT-62861
2023-10-24 19:32:54 +00:00
Dmitrii Gridin a60777b9a7 [FIR] move annotation recheck logic to ANNOTATIONS_ARGUMENTS_MAPPING phase
ARGUMENTS_OF_ANNOTATIONS will be dropped, so this check should be moved
This commit also drops class annotations resolution from implicit type
phase and provides the correct scope during argument mapping phase.
This code was effectively unreachable before

^KT-62679
2023-10-19 14:34:35 +00:00
Nikolay Lunyak a68a2409d3 [FIR] Remove the applicability filtering when reporting diagnostics
In case we don't want to introduce any new
abstractions like "user relevance for
applicability", we can just remove the
filtering.

^KT-62541 Fixed
2023-10-19 09:27:45 +00:00
Nikolay Lunyak fedadfb8db [FIR] Show ARGUMENTS_MAPPING_ERROR diagnostics along with INAPPLICABLE
K1 reports `ARGUMENT_TYPE_MISMATCH`
and `TOO_MANY_ARGUMENTS` together, and
one way to do it in K2 is to say that
their kinds of inapplicability difference
is not relevant to the user.

Note that K1 doesn't do such filtering,
so this change "makes K2 closer to K1",
but still different.

^KT-62541 Fixed

fixup! [FIR] Show ARGUMENTS_MAPPING_ERROR diagnostics along with INAPPLICABLE
2023-10-19 09:27:45 +00:00
Alejandro Serrano Mena b231e69cd3 Remove unneeded K1/K2 split in test 2023-10-18 12:34:58 +00:00
Alejandro Serrano Mena b9b15cba08 [K2] Warn about deprecation and opt-in markers for overrides of Any
^KT-62620 Fixed

Include opt-in markers in the diagnostics
2023-10-18 12:34:58 +00:00
Dmitriy Novozhilov 43929398da [FIR] Pass implications from subject of safe call in DFA
^KT-59689 Fixed
2023-10-18 12:17:44 +00:00
Anastasia.Nekrasova 9ad4cf4c55 [K2] Disappeared OPT_IN_USAGE_ERROR for a data class property during the destructuring declaration
^KT-62450
2023-10-17 21:27:13 +00:00
Anastasia.Nekrasova 4c9ad970ff [K2] Violation of OPT_IN_USAGE_ERROR non-propagating opt-in rules for typealias
^KT-62451
2023-10-12 09:03:39 +00:00
Anastasia.Nekrasova 6d446abe12 [K2] Disappeared OPT_IN_USAGE_ERROR for typealias
^KT-62451
2023-10-12 09:03:39 +00:00
Nikolay Lunyak 2e7dcd6096 [FIR] Require overrides to have matching isSuspend flag value
^KT-57100 Fixed
2023-10-09 06:55:43 +00:00
Nikolay Lunyak 4e58715760 [FIR] Check conflicting overloads via scopes
Scopes may return private symbols from
supertypes, they should not clash with
symbols from the current class.

For example, see:
`FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.FakeOverride#testPrivateFakeOverrides1`

Lombok shouldn't generate functions if the
user has defined explicit ones.

In K1 generated functions are not really
added to the declared members scope.

^KT-61243 Fixed
2023-10-09 06:55:43 +00:00
Mikhail Glukhikh aea7b8f00a Common supertypes: unwrap captured type from DNN type during recursion control
This commit handles subtle situation when K1 represents flexible type
arguments as just T..T?, but K2 does it as T&Any..T?.
This can provoke a type like Captured(*)&Any..Captured(*)?,
and before this commit we couldn't find recursion inside Captured(*)&Any.
This could lead to explosions inside type system and inference errors

#KT-60581 Fixed
2023-10-05 12:17:17 +00:00
Vladimir Sukharev 7b3e661776 [FIR] Fix Disappeared ANNOTATION_PARAMETER_DEFAULT_VALUE_MUST_BE_CONSTANT
^KT-59942 Fixed
2023-10-05 10:18:09 +00:00
Kirill Rakhman fbf68a5bcc [FIR] Narrow down range of NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER
This uses the same approach as
INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION where we use a visitor
to find a call to a symbol that contains the type variable in question.

#KT-56140 Fixed
2023-09-22 13:49:59 +00:00
Ilya Kirillov d98da87278 [FIR] Render dot-separated FQNs instead of slash-separated ones in diagnostics
^KT-62030 fixed
2023-09-22 10:48:31 +00:00
Kirill Rakhman e996760e7e [FIR] Fix rendering of SUSPENSION_POINT_INSIDE_CRITICAL_SECTION
#KT-61826 Fixed
2023-09-21 07:18:19 +00:00
Kirill Rakhman 0d279dd652 [FIR] Fix false negative JVM_STATIC_ON_CONST_OR_JVM_FIELD
... in presence of typealias.

#KT-61921
2023-09-18 12:13:02 +00:00
Kirill Rakhman f5f77d43bf [FIR] Fix false negative NO_REFLECTION_IN_CLASS_PATH
... in presence of typealiases.

#KT-61921
2023-09-18 12:13:02 +00:00
Kirill Rakhman f0112040fc [FIR AA] Unmute passing test 2023-09-14 10:03:02 +00:00
Dmitrii Gridin 31b36ee766 [LL FIR] introduce lazyResolveRecursively API
FirFile after KT-56683 has its own phases and resolution logic,
so we should have a separate API for lazy resolution for FirFile and for
the entire file

^KT-61296 Fixed
2023-09-13 20:26:50 +00:00
Nikolay Lunyak aacfc31c90 [FIR] Resolve the continuation type inside createSuspendView()
Normally such types are resolved during enhancement,
but creating the suspend view happens before
enhancement, so the type may have not been resolved.

^KT-59915 Fixed
2023-09-13 11:18:06 +00:00
Nikolay Lunyak 1467e743fd [FIR] Fix incorrect Java code in the test data
There's no point in eliminating K2 differences
between red code.

^KT-59915
2023-09-13 11:18:06 +00:00
Kirill Rakhman 2566dabfce [FIR] Report INVISIBLE_REFERENCE on the first unresolved qualifier
#KT-61719 Fixed
2023-09-11 14:23:55 +00:00
Denis.Zharkov 034671ad78 K2: Update substituted member candidate if it contains type variables
See the comment at updateSubstitutedMemberIfReceiverContainsTypeVariable

It became necessary after delegate inference is rewritten, since before
that happened, stub types were being left there and FIR2IR handled
them accidentally properly because stub types are equal to anything.

But that wasn't really correct even there because stub types are not
intended to leak out of the FIR

^KT-61060
2023-09-08 07:11:48 +00:00
Denis.Zharkov 033ff38fef K2: Adjust diagnostic test data after delegate inference is rewritten
In all tests, some red-code diagnostics have changed insignificantly
to some other combination or red-code diagnostics

^KT-61060 Related
2023-09-08 07:11:48 +00:00
Kirill Rakhman 10e94f90ac [Tests] Trim contents before checking for FIR_IDENTICAL 2023-09-06 11:32:57 +00:00
Kirill Rakhman 1c446151e7 [FIR] Skip resolvable package names in front of UNRESOLVED_REFERENCE
#KT-55471
2023-09-04 08:05:08 +00:00
Kirill Rakhman 10f7989af6 [FIR] Report UNRESOLVED_REFERENCE on the first unresolved qualifier
#KT-55471 Fixed
2023-09-04 08:05:07 +00:00
Brian Norman b55fda0c55 [FIR] Create CFG for files to track top-level property initialization
In order to properly analyze top-level property initialization, a
control-flow graph must be created for FirFiles. This change adds the
foundation for the file CFG and updates body resolve to create the CFG.
Checking the CFG for proper initialization is separated into a following
change to ease code review.

KT-56683
2023-08-31 12:50:52 +00:00
Kirill Rakhman 411210b520 [RAW FIR] Use range as source of desugared loop-related statements 2023-08-31 10:19:33 +00:00
Mikhail Glukhikh 3e330241b4 K1/K2: add a test to fix state of KT-55168 2023-08-28 09:40:26 +00:00
Kirill Rakhman 8d7c5b375e [FIR] Replace usages of FirExpression.typeRef with coneTypeOrNull
#KT-59855 Fixed
2023-08-24 07:54:57 +00:00