[MERGE] KT: build-1.5.0-dev-1616 KT/N: abfbfcde4 OLD: 8bb76c67e
This commit is contained in:
Generated
+7
@@ -8,6 +8,13 @@
|
||||
<inspection_tool class="SubjectLimit" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
||||
<component name="GithubSharedProjectSettings">
|
||||
<option name="branchProtectionPatterns">
|
||||
<list>
|
||||
<option value="master" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="IssueNavigationConfiguration">
|
||||
<option name="links">
|
||||
<list>
|
||||
|
||||
+331
@@ -1,5 +1,336 @@
|
||||
# CHANGELOG
|
||||
|
||||
|
||||
## 1.4.30-M1
|
||||
|
||||
### Android
|
||||
|
||||
- [`KT-42383`](https://youtrack.jetbrains.com/issue/KT-42383) HMPP: Bad IDEA dependencies: Missing dependency from p1:jvmAndAndroid to p2:jvmAndAndroid
|
||||
|
||||
### Backend. Native
|
||||
|
||||
- [`KT-38772`](https://youtrack.jetbrains.com/issue/KT-38772) Native: support non-reified type parameters in typeOf
|
||||
- [`KT-42234`](https://youtrack.jetbrains.com/issue/KT-42234) Move LLVM optimization parameters into konan.properties
|
||||
- [`KT-42649`](https://youtrack.jetbrains.com/issue/KT-42649) IndexOutOfBoundsException during InlineClassTransformer lowering
|
||||
- [`KT-42942`](https://youtrack.jetbrains.com/issue/KT-42942) Native: optimize peak backend memory by clearing BindingContext after psi2ir
|
||||
- [`KT-43198`](https://youtrack.jetbrains.com/issue/KT-43198) init blocks inside inline classes
|
||||
- [`KT-31072`](https://youtrack.jetbrains.com/issue/KT-31072) Don't use non-reified arguments to specialize type operations in IR inliner
|
||||
|
||||
### Backend. JS
|
||||
- [`KT-41227`](https://youtrack.jetbrains.com/issue/KT-41227) KJS IR: don't copy to child's prototype references to the function from parent
|
||||
|
||||
### Backend. IR
|
||||
- [`KT-41227`](https://youtrack.jetbrains.com/issue/KT-41227) KJS IR: don't copy to child's prototype references to the function from parent
|
||||
|
||||
### Compiler
|
||||
|
||||
#### New Features
|
||||
|
||||
- [`KT-28055`](https://youtrack.jetbrains.com/issue/KT-28055) Consider supporting `init` blocks inside inline classes
|
||||
- [`KT-28056`](https://youtrack.jetbrains.com/issue/KT-28056) Consider supporting non-public primary constructors for inline classes
|
||||
- [`KT-42094`](https://youtrack.jetbrains.com/issue/KT-42094) Allow open callable members in expect interfaces
|
||||
- [`KT-43129`](https://youtrack.jetbrains.com/issue/KT-43129) FIR: Support OverloadResolutionByLambdaReturnType
|
||||
|
||||
#### Performance Improvements
|
||||
|
||||
- [`KT-41352`](https://youtrack.jetbrains.com/issue/KT-41352) JVM IR: reduce bytecode size in for loops and range checks with 'until' by not using inclusive end
|
||||
- [`KT-41644`](https://youtrack.jetbrains.com/issue/KT-41644) NI: Infinite compilation
|
||||
- [`KT-42791`](https://youtrack.jetbrains.com/issue/KT-42791) OutOfMemoryError on compilation using kotlin 1.4 on a class with a lot of type inference
|
||||
- [`KT-42920`](https://youtrack.jetbrains.com/issue/KT-42920) NI: Improve performance around adding constraints
|
||||
|
||||
#### Fixes
|
||||
|
||||
- [`KT-22465`](https://youtrack.jetbrains.com/issue/KT-22465) Excessive synthetic method for private setter from superclass
|
||||
- [`KT-26229`](https://youtrack.jetbrains.com/issue/KT-26229) Lambda/anonymous function argument in parentheses is not supported for callsInPlace effect
|
||||
- [`KT-32228`](https://youtrack.jetbrains.com/issue/KT-32228) Inconsistent boxing/unboxing for inline classes when interface is specialized by object expression
|
||||
- [`KT-32450`](https://youtrack.jetbrains.com/issue/KT-32450) Inline class incorrectly gets re-wrapped when provided to a function
|
||||
- [`KT-35849`](https://youtrack.jetbrains.com/issue/KT-35849) Missing nullability assertion on lambda return value if expected type has generic return value type
|
||||
- [`KT-35902`](https://youtrack.jetbrains.com/issue/KT-35902) Kotlin generates a private parameterless constructor for constructors taking inline class arguments with default values
|
||||
- [`KT-36769`](https://youtrack.jetbrains.com/issue/KT-36769) JVM IR: Missing LVT entries for inline function (default) parameters at call site
|
||||
- [`KT-36982`](https://youtrack.jetbrains.com/issue/KT-36982) JVM IR: SAM adapter classes are generated as synthetic
|
||||
- [`KT-37007`](https://youtrack.jetbrains.com/issue/KT-37007) JVM IR: extraneous property accessors are generated in multifile facade for InlineOnly property
|
||||
- [`KT-37317`](https://youtrack.jetbrains.com/issue/KT-37317) [FIR] Add support of extension functions in postponed lambda completion
|
||||
- [`KT-38400`](https://youtrack.jetbrains.com/issue/KT-38400) FIR: interface abstract is preferred to Any method in super resolve
|
||||
- [`KT-38536`](https://youtrack.jetbrains.com/issue/KT-38536) JVM IR: bound adapted function references are not inlined
|
||||
- [`KT-38656`](https://youtrack.jetbrains.com/issue/KT-38656) FIR: determine overridden member visibility properly
|
||||
- [`KT-38901`](https://youtrack.jetbrains.com/issue/KT-38901) FIR: Make behavior of integer literals overflow consistent with FE 1.0
|
||||
- [`KT-39709`](https://youtrack.jetbrains.com/issue/KT-39709) [FIR] False positive UNINITIALIZED_VARIABLE in presence of complex graph with jumps
|
||||
- [`KT-39923`](https://youtrack.jetbrains.com/issue/KT-39923) Result.Failure will get wrapped with Success when using with RxJava
|
||||
- [`KT-40198`](https://youtrack.jetbrains.com/issue/KT-40198) '$default' methods in 'kotlin/test/AssertionsKt' generated as non-synthetic by JVM_IR
|
||||
- [`KT-40262`](https://youtrack.jetbrains.com/issue/KT-40262) ACC_DEPRECATED flag not generated for property getter delegate in multifile class facade in JVM_IR
|
||||
- [`KT-40282`](https://youtrack.jetbrains.com/issue/KT-40282) Inline class wrapping Any gets double boxed
|
||||
- [`KT-40464`](https://youtrack.jetbrains.com/issue/KT-40464) JVM_IR does not generate LINENUMBER at closing brace of (suspend) lambda
|
||||
- [`KT-40948`](https://youtrack.jetbrains.com/issue/KT-40948) IllegalAccessError while initializing val property in EXACTLY_ONCE lambda that is passed to another function
|
||||
- [`KT-41468`](https://youtrack.jetbrains.com/issue/KT-41468) JVM IR: IllegalAccessError on access to abstract base member from another package, from anonymous object inside abstract class
|
||||
- [`KT-41493`](https://youtrack.jetbrains.com/issue/KT-41493) JVM IR: names of classes for local delegated variables contain the variable name twice
|
||||
- [`KT-41792`](https://youtrack.jetbrains.com/issue/KT-41792) [FIR] Introduce & use ConeAttribute.UnsafeVariance
|
||||
- [`KT-41793`](https://youtrack.jetbrains.com/issue/KT-41793) [FIR] Make captured types accessible at the end of resolve
|
||||
- [`KT-41809`](https://youtrack.jetbrains.com/issue/KT-41809) JVM IR: name for internal $default method doesn't include module name
|
||||
- [`KT-41810`](https://youtrack.jetbrains.com/issue/KT-41810) JVM IR: Deprecated(HIDDEN) class is incorrectly generated as synthetic
|
||||
- [`KT-41841`](https://youtrack.jetbrains.com/issue/KT-41841) JVM IR: delegates for private functions with default arguments are generated in multifile classes
|
||||
- [`KT-41857`](https://youtrack.jetbrains.com/issue/KT-41857) Flaky 'ConcurrentModificationException' through `kotlin.serialization.DescriptorSerializer`
|
||||
- [`KT-41903`](https://youtrack.jetbrains.com/issue/KT-41903) JVM IR: do not generate LineNumberTable in auto-generated members of data classes
|
||||
- [`KT-41957`](https://youtrack.jetbrains.com/issue/KT-41957) JVM IR: step into suspend function goes to the first line of the file
|
||||
- [`KT-41960`](https://youtrack.jetbrains.com/issue/KT-41960) JVM IR: smart step into members implemented with delegation to interface doesn't work
|
||||
- [`KT-41961`](https://youtrack.jetbrains.com/issue/KT-41961) JVM IR: line numbers are not generated in JvmMultifileClass facade declarations
|
||||
- [`KT-41962`](https://youtrack.jetbrains.com/issue/KT-41962) JVM IR: intermittent -1 line numbers in the state machine cause double stepping in the debugger
|
||||
- [`KT-42002`](https://youtrack.jetbrains.com/issue/KT-42002) JVM / IR: IllegalStateException: "No mapping for symbol: VAR IR_TEMPORARY_VARIABLE" caused by named arguments
|
||||
- [`KT-42021`](https://youtrack.jetbrains.com/issue/KT-42021) JVM / IR: "IndexOutOfBoundsException: Index 0 out of bounds for length 0" during IR lowering with suspend conversion
|
||||
- [`KT-42033`](https://youtrack.jetbrains.com/issue/KT-42033) JVM IR: accidental override in Map subclass with custom implementations of some members
|
||||
- [`KT-42043`](https://youtrack.jetbrains.com/issue/KT-42043) JVM IR: Don't generate collection stubs when implementing methods with more specific return types
|
||||
- [`KT-42044`](https://youtrack.jetbrains.com/issue/KT-42044) Compiler error when lambda with contract surrounded with parentheses
|
||||
- [`KT-42114`](https://youtrack.jetbrains.com/issue/KT-42114) JVM_IR generates stub for 'removeIf' in abstract classes implementing 'List' and 'Set'
|
||||
- [`KT-42115`](https://youtrack.jetbrains.com/issue/KT-42115) JVM_IR doesn't generate 'next' and 'hasNext' method in an abstract class implementing 'ListIterator'
|
||||
- [`KT-42116`](https://youtrack.jetbrains.com/issue/KT-42116) FIR: Java accessor function should not exist in scope together with relevant property
|
||||
- [`KT-42117`](https://youtrack.jetbrains.com/issue/KT-42117) IR-based evaluator cannot handle Java static final fields
|
||||
- [`KT-42118`](https://youtrack.jetbrains.com/issue/KT-42118) FIR2IR: field-targeted annotation is placed on a property, not on a field
|
||||
- [`KT-42130`](https://youtrack.jetbrains.com/issue/KT-42130) FIR: type variable is observed after when condition analysis
|
||||
- [`KT-42132`](https://youtrack.jetbrains.com/issue/KT-42132) FIR2IR: companion function reference has no dispatch receiver
|
||||
- [`KT-42137`](https://youtrack.jetbrains.com/issue/KT-42137) JVM IR: AbstractMethodError on complex hierarchy where implementation comes from another supertype and has a more specific type
|
||||
- [`KT-42186`](https://youtrack.jetbrains.com/issue/KT-42186) JVM / IR: Infinite cycle in for expression when unsigned bytes are used in decreasing loop range
|
||||
- [`KT-42251`](https://youtrack.jetbrains.com/issue/KT-42251) JVM / IR: "IllegalStateException: Descriptor can be left only if it is last" when comparing the i-th element of the container of Int? and `i` with change
|
||||
- [`KT-42253`](https://youtrack.jetbrains.com/issue/KT-42253) JVM IR: NoSuchFieldError on local delegated property in inline function whose call site happens before declaration in the source
|
||||
- [`KT-42281`](https://youtrack.jetbrains.com/issue/KT-42281) JVM / IR: AnalyzerException when comparing Int and array that cast to Any in if condition
|
||||
- [`KT-42340`](https://youtrack.jetbrains.com/issue/KT-42340) FIR2IR: duplicating fake overrides
|
||||
- [`KT-42344`](https://youtrack.jetbrains.com/issue/KT-42344) IR-based evaluator doesn't support "annotation in annotation"
|
||||
- [`KT-42346`](https://youtrack.jetbrains.com/issue/KT-42346) FIR: double-vararg in IR while resolving collection literal as Java annotation argument
|
||||
- [`KT-42348`](https://youtrack.jetbrains.com/issue/KT-42348) FIR: false UNINITIALIZED_VARIABLE in local class
|
||||
- [`KT-42350`](https://youtrack.jetbrains.com/issue/KT-42350) FIR: false UNINITIALIZED_VARIABLE after initialization in try block
|
||||
- [`KT-42351`](https://youtrack.jetbrains.com/issue/KT-42351) FIR: false HIDDEN in enum entry member call
|
||||
- [`KT-42354`](https://youtrack.jetbrains.com/issue/KT-42354) JVM / IR: "AssertionError: Unexpected IR element found during code generation" with KProperty `get` invocation
|
||||
- [`KT-42359`](https://youtrack.jetbrains.com/issue/KT-42359) FIR2IR: cannot mangle type parameter
|
||||
- [`KT-42373`](https://youtrack.jetbrains.com/issue/KT-42373) FIR2IR: local object nested class has no parent if forward-referenced by nested class supertype
|
||||
- [`KT-42384`](https://youtrack.jetbrains.com/issue/KT-42384) FIR (BE): top-level field has no parent class in BE
|
||||
- [`KT-42496`](https://youtrack.jetbrains.com/issue/KT-42496) FIR resolve: synthetic property is written but has no setter
|
||||
- [`KT-42517`](https://youtrack.jetbrains.com/issue/KT-42517) FIR: exception in BE for recursive inline call
|
||||
- [`KT-42601`](https://youtrack.jetbrains.com/issue/KT-42601) [FIR] Inherited declaration clash for stdlib inheritors
|
||||
- [`KT-42642`](https://youtrack.jetbrains.com/issue/KT-42642) ISE: No `getProgressionLastElement` for progression type IntProgressionType
|
||||
- [`KT-42650`](https://youtrack.jetbrains.com/issue/KT-42650) JVM IR: extraneous nullability annotation on a generic function of a flexible type
|
||||
- [`KT-42656`](https://youtrack.jetbrains.com/issue/KT-42656) FIR2IR: unsupported callable reference for Java field
|
||||
- [`KT-42725`](https://youtrack.jetbrains.com/issue/KT-42725) Debugger steps into core library inline functions in chained calls
|
||||
- [`KT-42758`](https://youtrack.jetbrains.com/issue/KT-42758) JVM / IR: Deserialized object that overrides readResolve() is not reference equal to the singleton instance
|
||||
- [`KT-42770`](https://youtrack.jetbrains.com/issue/KT-42770) FIR: duplicating signatures in mangler (typealias for functional type)
|
||||
- [`KT-42771`](https://youtrack.jetbrains.com/issue/KT-42771) FIR: duplicating signature in mangler (data class with delegate)
|
||||
- [`KT-42814`](https://youtrack.jetbrains.com/issue/KT-42814) FIR: false UNINITIALIZED_VARIABLE in local function after if...else
|
||||
- [`KT-42844`](https://youtrack.jetbrains.com/issue/KT-42844) FIR: Property write in init block resolved to parameter write
|
||||
- [`KT-42846`](https://youtrack.jetbrains.com/issue/KT-42846) JVM_IR: NPE on function reference to @JvmStatic method in a different file
|
||||
- [`KT-42933`](https://youtrack.jetbrains.com/issue/KT-42933) JVM / IR: "AnalyzerException: Expected an object reference, but found I" with local delegate in inline class
|
||||
- [`KT-43006`](https://youtrack.jetbrains.com/issue/KT-43006) JVM/JVM_IR: do not generate no-arg constructor for constructor with default arguments if there are inline class types in the signature
|
||||
- [`KT-43017`](https://youtrack.jetbrains.com/issue/KT-43017) JVM / IR: AssertionError when callable reference passed into a function requiring a suspendable function
|
||||
- [`KT-43068`](https://youtrack.jetbrains.com/issue/KT-43068) JVM IR: no generic signatures for explicitly written methods in a List subclass, whose signature coincides with MutableList methods
|
||||
- [`KT-43132`](https://youtrack.jetbrains.com/issue/KT-43132) JVM / IR: Method name '<get-...>' in class '...$screenTexts$1$1' cannot be represented in dex format.
|
||||
- [`KT-43145`](https://youtrack.jetbrains.com/issue/KT-43145) JVM IR: $default methods in multi-file facades are generated as non-synthetic final
|
||||
- [`KT-43156`](https://youtrack.jetbrains.com/issue/KT-43156) FIR: false UNINITIALIZED_VARIABLE after initialization in `synchronized` block
|
||||
- [`KT-43196`](https://youtrack.jetbrains.com/issue/KT-43196) JVM: extra non-static member is generated for extension property in inline class
|
||||
- [`KT-43199`](https://youtrack.jetbrains.com/issue/KT-43199) JVM IR: synthetic flag for deprecated-hidden is not generated for DeprecatedSinceKotlin and deprecation from override
|
||||
- [`KT-43207`](https://youtrack.jetbrains.com/issue/KT-43207) JVM IR: no collection stub for `iterator` is generated on extending AbstractCollection
|
||||
- [`KT-43217`](https://youtrack.jetbrains.com/issue/KT-43217) JVM_IR: Multiple FAKE_OVERRIDES for java methods using @NonNull Double and java double
|
||||
- [`KT-43226`](https://youtrack.jetbrains.com/issue/KT-43226) "Incompatible stack heights" with non-local return to outer lambda inside suspend lambda
|
||||
- [`KT-43242`](https://youtrack.jetbrains.com/issue/KT-43242) JVM / IR: "AnalyzerException: Expected I, but found R" caused by `when` inside object with @Nullable Integer subject
|
||||
- [`KT-43249`](https://youtrack.jetbrains.com/issue/KT-43249) Wrong code generated for suspend lambdas with inline class parameters
|
||||
- [`KT-43286`](https://youtrack.jetbrains.com/issue/KT-43286) JVM IR: IAE "Inline class types should have the same representation: Lkotlin/UInt; != I" on smart cast of unsigned type value with JVM target 1.8
|
||||
- [`KT-43326`](https://youtrack.jetbrains.com/issue/KT-43326) JVM_IR: No deprecated flag for getter of deprecated interface property copied to DefaultImpls
|
||||
- [`KT-43327`](https://youtrack.jetbrains.com/issue/KT-43327) JVM_IR: No deprecated or synthetic flag for accessors of deprecated-hidden property of unsigned type
|
||||
- [`KT-43332`](https://youtrack.jetbrains.com/issue/KT-43332) FIR: Smart casts lead to false-positive ambiguity
|
||||
- [`KT-43370`](https://youtrack.jetbrains.com/issue/KT-43370) JVM IR: No deprecated flag for getter of deprecated property copied via delegation by interface
|
||||
- [`KT-43525`](https://youtrack.jetbrains.com/issue/KT-43525) Prohibit JvmOverloads on declarations with inline class types in parameters
|
||||
- [`KT-43562`](https://youtrack.jetbrains.com/issue/KT-43562) JVM IR: incorrect mangling for Collection.size in unsigned arrays
|
||||
- [`KT-43584`](https://youtrack.jetbrains.com/issue/KT-43584) [FIR] Java annotations with named arguments aren't loaded correctly
|
||||
|
||||
### IDE
|
||||
|
||||
- [`KT-31553`](https://youtrack.jetbrains.com/issue/KT-31553) Complete Statement: Wrong auto-insertion of closing curly brace for a code block
|
||||
- [`KT-33466`](https://youtrack.jetbrains.com/issue/KT-33466) IDE generates incorrect `external override` with body for overriding `open external` method
|
||||
- [`KT-39458`](https://youtrack.jetbrains.com/issue/KT-39458) Add CLI support for UL classes
|
||||
- [`KT-40403`](https://youtrack.jetbrains.com/issue/KT-40403) UAST: PsiMethod for invoked extension function/property misses `@receiver:` annotations
|
||||
- [`KT-41406`](https://youtrack.jetbrains.com/issue/KT-41406) Kotlin doesn't report annotations for type arguments (no way to add `@Nls`, `@NonNls` annotations to String collections in Kotlin)
|
||||
- [`KT-41420`](https://youtrack.jetbrains.com/issue/KT-41420) UAST does not return information about type annotations
|
||||
- [`KT-42754`](https://youtrack.jetbrains.com/issue/KT-42754) MPP: no smart cast for Common nullable property used in platform module
|
||||
- [`KT-42821`](https://youtrack.jetbrains.com/issue/KT-42821) MPP, IDE: Platform-specific errors are reported even when build doesn't target that platform
|
||||
|
||||
### IDE. Android
|
||||
|
||||
- [`KT-42381`](https://youtrack.jetbrains.com/issue/KT-42381) MPP: Bad IDEA dependencies: JVM module depending on built artifact instead of sources of module with Android Plugin applied
|
||||
|
||||
### IDE. Inspections and Intentions
|
||||
|
||||
#### New Features
|
||||
|
||||
- [`KT-22666`](https://youtrack.jetbrains.com/issue/KT-22666) "Create enum constant" quick fix could be provided
|
||||
- [`KT-24556`](https://youtrack.jetbrains.com/issue/KT-24556) Add Remove quick fix for "Expression under 'when' is never equal to null"
|
||||
- [`KT-34121`](https://youtrack.jetbrains.com/issue/KT-34121) Report unused result of data class `copy` method
|
||||
- [`KT-34533`](https://youtrack.jetbrains.com/issue/KT-34533) INLINE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER: Add quickfix "Add val to parameter"
|
||||
- [`KT-35215`](https://youtrack.jetbrains.com/issue/KT-35215) Quickfix for CONST_VAL_NOT_TOP_LEVEL_OR_OBJECT to remove `const` modifier
|
||||
- [`KT-40251`](https://youtrack.jetbrains.com/issue/KT-40251) Intention action to evaluate compile time expression
|
||||
|
||||
#### Fixes
|
||||
|
||||
- [`KT-20420`](https://youtrack.jetbrains.com/issue/KT-20420) Intention "Put arguments/parameters on separate lines" doesn't respect the "Place ')' on new line" Kotlin code style setting
|
||||
- [`KT-21799`](https://youtrack.jetbrains.com/issue/KT-21799) Quickfix "Change function signature" for receiver type doesn't change it
|
||||
- [`KT-22665`](https://youtrack.jetbrains.com/issue/KT-22665) "Create object" quick fix produce wrong code for enum
|
||||
- [`KT-23934`](https://youtrack.jetbrains.com/issue/KT-23934) IntelliJ suggest "merge map to joinToString" even when such action is impossible due to suspending actions in map
|
||||
- [`KT-30894`](https://youtrack.jetbrains.com/issue/KT-30894) Wrong results of intention "Add names to call arguments" when backticked argument starts from digit
|
||||
- [`KT-31523`](https://youtrack.jetbrains.com/issue/KT-31523) ReplaceWith introduces additional argument name for lambda when named argument is used on call-site
|
||||
- [`KT-31833`](https://youtrack.jetbrains.com/issue/KT-31833) JavaMapForEachInspection should report for expression with implicit receiver
|
||||
- [`KT-33096`](https://youtrack.jetbrains.com/issue/KT-33096) Turn 'MapGetWithNotNullAssertionOperator' into an intention
|
||||
- [`KT-33212`](https://youtrack.jetbrains.com/issue/KT-33212) False positive "map.put() should be converted to assignment" inspection when class inherited from MutableMap has "set" method
|
||||
- [`KT-34270`](https://youtrack.jetbrains.com/issue/KT-34270) False negative "Join declaration and assignment" with constructor call
|
||||
- [`KT-34859`](https://youtrack.jetbrains.com/issue/KT-34859) False positive "Should be replaced with Kotlin function" inspection for Character.toString(int) function
|
||||
- [`KT-34959`](https://youtrack.jetbrains.com/issue/KT-34959) False positive "Redundant overriding method" with different implemented/overridden signatures
|
||||
- [`KT-35051`](https://youtrack.jetbrains.com/issue/KT-35051) False positive "Remove redundant backticks" if variable inside the string and isn't followed by space
|
||||
- [`KT-35097`](https://youtrack.jetbrains.com/issue/KT-35097) False positive "Call replaceable with binary operator" on explicit 'equals' call on a platform type value
|
||||
- [`KT-35165`](https://youtrack.jetbrains.com/issue/KT-35165) "Replace 'if' with elvis operator": don't suggest if val initializer is a complex expression
|
||||
- [`KT-35346`](https://youtrack.jetbrains.com/issue/KT-35346) False positive 'Make internal' suggestion for function inside interface
|
||||
- [`KT-35357`](https://youtrack.jetbrains.com/issue/KT-35357) "Move lambda argument out of parentheses" does not preserve block comments
|
||||
- [`KT-38349`](https://youtrack.jetbrains.com/issue/KT-38349) Invalid suggestion to fold to elvis when having a var-variable
|
||||
- [`KT-40704`](https://youtrack.jetbrains.com/issue/KT-40704) False negative "Redundant semicolon" at start of line
|
||||
- [`KT-40861`](https://youtrack.jetbrains.com/issue/KT-40861) "Convert to secondary constructor" intention expected on class name
|
||||
- [`KT-40879`](https://youtrack.jetbrains.com/issue/KT-40879) False positive "Redundant 'inner' modifier" when calling another inner class with empty constructor
|
||||
- [`KT-40985`](https://youtrack.jetbrains.com/issue/KT-40985) "Remove explicit type arguments" is suggested when type has an annotation
|
||||
- [`KT-41223`](https://youtrack.jetbrains.com/issue/KT-41223) False positive "Redundant inner modifier" inspection ignores constructor arguments of object expressions
|
||||
- [`KT-41246`](https://youtrack.jetbrains.com/issue/KT-41246) False positive "Receiver parameter is never used" with anonymous function expression
|
||||
- [`KT-41298`](https://youtrack.jetbrains.com/issue/KT-41298) "Remove redundant 'with' call" intention works incorrectly with non-local returns and single-expression functions
|
||||
- [`KT-41311`](https://youtrack.jetbrains.com/issue/KT-41311) False positive "Redundant inner modifier" when deriving from a nested Java class
|
||||
- [`KT-41499`](https://youtrack.jetbrains.com/issue/KT-41499) "Convert receiver to parameter" produces code with incorrect order of generic type and function invocation in case of generic function with lambda as a parameter
|
||||
- [`KT-41680`](https://youtrack.jetbrains.com/issue/KT-41680) False positive "Redundant inner modifier" when deriving from class with non-empty constructor and value passed to it from enclosing class
|
||||
- [`KT-42201`](https://youtrack.jetbrains.com/issue/KT-42201) Add Opt-In action doesn't work if there is already OptIn annotation
|
||||
- [`KT-42255`](https://youtrack.jetbrains.com/issue/KT-42255) "Replace elvis expression with 'if' expression" intention shouldn't introduce unnecessary variable if 'error' expression is used
|
||||
|
||||
### IDE. JS
|
||||
|
||||
- [`KT-43760`](https://youtrack.jetbrains.com/issue/KT-43760) KJS: Debugging Kotlin code for Node.js runtime doesn't work
|
||||
|
||||
### IDE. Scratch
|
||||
|
||||
- [`KT-43415`](https://youtrack.jetbrains.com/issue/KT-43415) Kotlin scratch file could not be run and could lead to dead lock
|
||||
|
||||
### JavaScript
|
||||
|
||||
#### Fixes
|
||||
|
||||
- [`KT-31072`](https://youtrack.jetbrains.com/issue/KT-31072) Don't use non-reified arguments to specialize type operations in IR inliner
|
||||
- [`KT-39964`](https://youtrack.jetbrains.com/issue/KT-39964) Throwable incorrectly implements constructor for (null, cause) args in K/JS-IR
|
||||
- [`KT-40090`](https://youtrack.jetbrains.com/issue/KT-40090) KJS: IR. Invalid behaviour for optional parameters (redundant tail undefined parameters)
|
||||
- [`KT-40686`](https://youtrack.jetbrains.com/issue/KT-40686) KJS: Uncaught ReferenceError caused by external class as type inside eventListener in init block
|
||||
- [`KT-40771`](https://youtrack.jetbrains.com/issue/KT-40771) KJS / IR: "ReferenceError: Metadata is not defined" caused by default parameter value in inner class constructor
|
||||
- [`KT-41032`](https://youtrack.jetbrains.com/issue/KT-41032) KJS / IR: "AssertionError: Assertion failed" caused by class that is delegated to inherited interface
|
||||
- [`KT-41771`](https://youtrack.jetbrains.com/issue/KT-41771) KJS / IR: IndexOutOfBoundsException "Index 0 out of bounds for length 0" caused by inline class with List in primary constructor and vararg in secondary
|
||||
- [`KT-42025`](https://youtrack.jetbrains.com/issue/KT-42025) KJS / IR: IrConstructorCallImpl: No such type argument slot: 0
|
||||
- [`KT-42112`](https://youtrack.jetbrains.com/issue/KT-42112) KJS: StackOverflowError on @JsExport in case of name clash with function with Enum parameter with star-projection
|
||||
- [`KT-42262`](https://youtrack.jetbrains.com/issue/KT-42262) KJS: `break`-statements without label are ignored in a `when`
|
||||
- [`KT-42364`](https://youtrack.jetbrains.com/issue/KT-42364) KJS: Properties of interface delegate are non-configurable
|
||||
- [`KT-43222`](https://youtrack.jetbrains.com/issue/KT-43222) KJS IR: prototype lazy initialization for top-level properties like in JVM
|
||||
- [`KT-43313`](https://youtrack.jetbrains.com/issue/KT-43313) KJS / IR: "Can't find name for declaration FUN" for secondary constructor
|
||||
|
||||
### KMM Plugin
|
||||
|
||||
- [`KT-41677`](https://youtrack.jetbrains.com/issue/KT-41677) Could not launch iOS project with custom display name
|
||||
- [`KT-42463`](https://youtrack.jetbrains.com/issue/KT-42463) Launch common tests on local JVM via run gutter
|
||||
- [`KT-43188`](https://youtrack.jetbrains.com/issue/KT-43188) NoSuchMethodError in New Module Wizard of KMM Project
|
||||
|
||||
### Libraries
|
||||
|
||||
- [`KT-41112`](https://youtrack.jetbrains.com/issue/KT-41112) Docs: add more details about bit shift operations
|
||||
- [`KT-41356`](https://youtrack.jetbrains.com/issue/KT-41356) Incorrect documentation for `rangeTo` function
|
||||
|
||||
### Middle-end. IR
|
||||
|
||||
- [`KT-41765`](https://youtrack.jetbrains.com/issue/KT-41765) [Native/IR] Could not resolveFakeOverride()
|
||||
- [`KT-42054`](https://youtrack.jetbrains.com/issue/KT-42054) Psi2ir: "RuntimeException: IrSimpleFunctionSymbolImpl is already bound" when using result of function with overload resolution by lambda return type
|
||||
|
||||
### Native
|
||||
|
||||
- [`KT-42822`](https://youtrack.jetbrains.com/issue/KT-42822) Kotlin/Native Worker leaks ObjC/Swift autorelease references (and indirectly bridged K/N references) on Darwin targets
|
||||
- [`KT-42397`](https://youtrack.jetbrains.com/issue/KT-42397) Reverse C interop usage of companion object reports spurious leaks
|
||||
|
||||
### Native. C and ObjC Import
|
||||
|
||||
- [`KT-42412`](https://youtrack.jetbrains.com/issue/KT-42412) [C-interop] Modality of generated property accessors is always FINAL
|
||||
|
||||
### Native. ObjC Export
|
||||
|
||||
- [`KT-38530`](https://youtrack.jetbrains.com/issue/KT-38530) Native: values() method of enum classes is not exposed to Objective-C/Swift
|
||||
|
||||
### Native. Platform libraries
|
||||
|
||||
- [`KT-43597`](https://youtrack.jetbrains.com/issue/KT-43597) Support for Xcode 12.2 SDK
|
||||
|
||||
### Native. Platforms
|
||||
|
||||
- [`KT-43276`](https://youtrack.jetbrains.com/issue/KT-43276) Support watchos_x64 target
|
||||
|
||||
### Native. Runtime
|
||||
|
||||
- [`KT-42822`](https://youtrack.jetbrains.com/issue/KT-42822) Kotlin/Native Worker leaks ObjC/Swift autorelease references (and indirectly bridged K/N references) on Darwin targets
|
||||
|
||||
### Native. Stdlib
|
||||
|
||||
- [`KT-42428`](https://youtrack.jetbrains.com/issue/KT-42428) Inconsistent behavior of map.entries on Kotlin.Native
|
||||
|
||||
### Reflection
|
||||
|
||||
- [`KT-34024`](https://youtrack.jetbrains.com/issue/KT-34024) "KotlinReflectionInternalError: Inconsistent number of parameters" with `javaMethod` on suspending functions with inline class in function signature or inside the function
|
||||
|
||||
### Tools. CLI
|
||||
|
||||
- [`KT-43406`](https://youtrack.jetbrains.com/issue/KT-43406) JVM: produce deterministic jar files if -d option value is a .jar file
|
||||
|
||||
### Tools. CLI. Native
|
||||
|
||||
- [`KT-40670`](https://youtrack.jetbrains.com/issue/KT-40670) Allow to override konan.properties via CLI
|
||||
|
||||
### Tools. Compiler Plugins
|
||||
|
||||
- [`KT-41764`](https://youtrack.jetbrains.com/issue/KT-41764) KJS /IR IllegalStateException: "Symbol for public kotlin/arrayOf is unbound" with serialization plugin
|
||||
- [`KT-42976`](https://youtrack.jetbrains.com/issue/KT-42976) kotlinx.serialization + JVM IR: NPE on annotation with @SerialInfo
|
||||
|
||||
### Tools. Gradle
|
||||
|
||||
- [`KT-38692`](https://youtrack.jetbrains.com/issue/KT-38692) KaptGenerateStubs Gradle task will not clean up outputs when sources are empty and not an incremental build
|
||||
- [`KT-40140`](https://youtrack.jetbrains.com/issue/KT-40140) kotlin-android plugin eagerly creates several Gradle tasks
|
||||
- [`KT-41295`](https://youtrack.jetbrains.com/issue/KT-41295) Kotlin Gradle Plugin 1.4.20 Configuration Caching bug due to friendPath provider
|
||||
- [`KT-42058`](https://youtrack.jetbrains.com/issue/KT-42058) Support moduleName option in Kotlin Gradle plugin for JVM
|
||||
- [`KT-43054`](https://youtrack.jetbrains.com/issue/KT-43054) Implementation of `AbstractKotlinTarget#buildAdhocComponentsFromKotlinVariants` breaks configuration caching
|
||||
- [`KT-43489`](https://youtrack.jetbrains.com/issue/KT-43489) Incremental compilation - unable to find history files causing full recompilation
|
||||
|
||||
### Tools. Gradle. JS
|
||||
|
||||
- [`KT-42400`](https://youtrack.jetbrains.com/issue/KT-42400) Kotlin/JS: Gradle DSL: customField() is rejected in Groovy build.gradle
|
||||
- [`KT-42462`](https://youtrack.jetbrains.com/issue/KT-42462) NPM dependency declaration with Groovy interpolated string
|
||||
- [`KT-42954`](https://youtrack.jetbrains.com/issue/KT-42954) Kotlin/JS: IDE import after changing `kotlin.js.externals.output.format` does not re-generate externals
|
||||
- [`KT-43535`](https://youtrack.jetbrains.com/issue/KT-43535) Common webpack configuration breaks on lambda serialization in some cases
|
||||
|
||||
### Tools. Gradle. Multiplatform
|
||||
|
||||
- [`KT-42269`](https://youtrack.jetbrains.com/issue/KT-42269) Setup default dependsOn edges for Android source sets
|
||||
- [`KT-42413`](https://youtrack.jetbrains.com/issue/KT-42413) [MPP/gradle] `withJava` breaks build on 1.4.20-M1
|
||||
- [`KT-43141`](https://youtrack.jetbrains.com/issue/KT-43141) Gradle / Configuration cache: NPE from org.jetbrains.kotlin.gradle.tasks.KotlinCompileCommon.getKotlinOptions() on reusing configuration cache for task compileCommonMainKotlinMetadata
|
||||
- [`KT-43329`](https://youtrack.jetbrains.com/issue/KT-43329) Gradle / Configuration cache: IAE “Parameter specified as non-null is null: method KotlinMetadataTargetConfiguratorKt.isCompatibilityMetadataVariantEnabled, parameter $this$isCompatibilityMetadataVariantEnabled” on reusing configuration cache for task compileKotlinMetadata
|
||||
|
||||
### Tools. Gradle. Native
|
||||
|
||||
- [`KT-39564`](https://youtrack.jetbrains.com/issue/KT-39564) Make kotlin-native Gradle tasks Cacheable
|
||||
- [`KT-42485`](https://youtrack.jetbrains.com/issue/KT-42485) Fail on cinterop: clang_indexTranslationUnit returned 1
|
||||
- [`KT-42550`](https://youtrack.jetbrains.com/issue/KT-42550) Adding subspec dependency with git location failed
|
||||
- [`KT-42849`](https://youtrack.jetbrains.com/issue/KT-42849) Gradle / Configuration cache: tasks nativeMetadataJar, runReleaseExecutableNative, runDebugExecutableNative are unsupported and fails on reusing configuration cache
|
||||
- [`KT-42938`](https://youtrack.jetbrains.com/issue/KT-42938) CocoaPods Gradle plugin: podBuildDependencies doesn't properly report xcodebuild failures
|
||||
- [`KT-43151`](https://youtrack.jetbrains.com/issue/KT-43151) Gradle / Configuration cache: UPAE “lateinit property binary has not been initialized” on reusing configuration cache for linkDebugExecutableNative, linkDebugTestNative, linkReleaseExecutableNative tasks
|
||||
- [`KT-40999`](https://youtrack.jetbrains.com/issue/KT-40999) CocoaPods Gradle plugin: Support custom cinterop options when declaring a pod dependency.
|
||||
|
||||
### Tools. Parcelize
|
||||
|
||||
- [`KT-41553`](https://youtrack.jetbrains.com/issue/KT-41553) JVM IR, Parcelize: IrStarProjectionImpl cannot be cast to class IrTypeProjection
|
||||
|
||||
### Tools. kapt
|
||||
|
||||
- [`KT-34340`](https://youtrack.jetbrains.com/issue/KT-34340) Incremental annotation processor recompile all files (only if KAPT enabled).
|
||||
- [`KT-36667`](https://youtrack.jetbrains.com/issue/KT-36667) Kapt: Add a flag to strip kotlin.Metadata() annotations from stubs
|
||||
- [`KT-40493`](https://youtrack.jetbrains.com/issue/KT-40493) KAPT does not support aggregating annotations processors in incremental mode
|
||||
- [`KT-40882`](https://youtrack.jetbrains.com/issue/KT-40882) Kapt stub generation is non-deterministic for incremental compilation
|
||||
- [`KT-41788`](https://youtrack.jetbrains.com/issue/KT-41788) NullPointerException: Random crashes of build using gradle and kapt because of not calling Processor.init()
|
||||
- [`KT-42182`](https://youtrack.jetbrains.com/issue/KT-42182) KAPT: Does not consider generated sources for incremental compilation.
|
||||
|
||||
|
||||
## 1.4.20
|
||||
|
||||
### Android
|
||||
|
||||
@@ -16,9 +16,12 @@
|
||||
|
||||
package org.jetbrains.kotlin.ant
|
||||
|
||||
import org.apache.tools.ant.types.Path
|
||||
import org.apache.tools.ant.types.Reference
|
||||
import org.apache.tools.ant.BuildException
|
||||
import org.apache.tools.ant.taskdefs.Execute
|
||||
import org.apache.tools.ant.taskdefs.Redirector
|
||||
import org.apache.tools.ant.types.*
|
||||
import java.io.File.pathSeparator
|
||||
import java.io.File.separator
|
||||
|
||||
class Kotlin2JvmTask : KotlinCompilerBaseTask() {
|
||||
override val compilerFqName = "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler"
|
||||
@@ -28,6 +31,9 @@ class Kotlin2JvmTask : KotlinCompilerBaseTask() {
|
||||
|
||||
var noReflect: Boolean = false
|
||||
|
||||
private val cmdl = CommandlineJava()
|
||||
var fork: Boolean = false
|
||||
|
||||
private var compileClasspath: Path? = null
|
||||
|
||||
fun setClasspath(classpath: Path) {
|
||||
@@ -73,4 +79,47 @@ class Kotlin2JvmTask : KotlinCompilerBaseTask() {
|
||||
if (noReflect) args.add("-no-reflect")
|
||||
if (includeRuntime) args.add("-include-runtime")
|
||||
}
|
||||
|
||||
override fun execute() {
|
||||
if (!fork)
|
||||
super.execute()
|
||||
else {
|
||||
exec()
|
||||
}
|
||||
}
|
||||
|
||||
private fun exec() {
|
||||
val javaHome = System.getProperty("java.home")
|
||||
val javaBin = javaHome + separator + "bin" + separator + "java"
|
||||
val redirector = Redirector(this)
|
||||
|
||||
fillArguments()
|
||||
|
||||
val command = ArrayList<String>()
|
||||
command.add(javaBin)
|
||||
command.addAll(cmdl.vmCommand.arguments) // jvm args
|
||||
command.add("-Dorg.jetbrains.kotlin.cliMessageRenderer=FullPath") // same MessageRenderer as non-forking mode
|
||||
command.add("-cp")
|
||||
command.add(KotlinAntTaskUtil.compilerJar.canonicalPath)
|
||||
command.add(compilerFqName)
|
||||
command.addAll(args) // compiler args
|
||||
|
||||
// streamHandler: used to handle the input and output streams of the subprocess.
|
||||
// watchdog: a watchdog for the subprocess or <code>null</code> to disable a timeout for the subprocess.
|
||||
// TODO: support timeout for the subprocess
|
||||
val exe = Execute(redirector.createHandler(), null)
|
||||
exe.setAntRun(getProject())
|
||||
exe.commandline = command.toTypedArray()
|
||||
log("Executing command: ${command.joinToString(" ")}", LogLevel.DEBUG.level)
|
||||
log("Compiling ${src!!.list().toList()} => [${output!!.canonicalPath}]")
|
||||
val exitCode = exe.execute()
|
||||
redirector.complete()
|
||||
if (failOnError && exitCode != 0) {
|
||||
throw BuildException("Compile failed; see the compiler error output for details.")
|
||||
}
|
||||
}
|
||||
|
||||
fun createJvmarg(): Commandline.Argument {
|
||||
return cmdl.createVmArgument()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ abstract class KotlinCompilerBaseTask : Task() {
|
||||
fillSpecificArguments()
|
||||
}
|
||||
|
||||
final override fun execute() {
|
||||
override fun execute() {
|
||||
fillArguments()
|
||||
|
||||
val compilerClass = KotlinAntTaskUtil.getOrCreateClassLoader().loadClass(compilerFqName)
|
||||
|
||||
@@ -17,9 +17,6 @@ interface BuildMetaInfo {
|
||||
val compilerBuildVersion: String
|
||||
val languageVersionString: String
|
||||
val apiVersionString: String
|
||||
val coroutinesEnable: Boolean
|
||||
val coroutinesWarn: Boolean
|
||||
val coroutinesError: Boolean
|
||||
val multiplatformEnable: Boolean
|
||||
val metadataVersionMajor: Int
|
||||
val metadataVersionMinor: Int
|
||||
@@ -35,9 +32,6 @@ abstract class BuildMetaInfoFactory<T : BuildMetaInfo>(private val metaInfoClass
|
||||
compilerBuildVersion: String,
|
||||
languageVersionString: String,
|
||||
apiVersionString: String,
|
||||
coroutinesEnable: Boolean,
|
||||
coroutinesWarn: Boolean,
|
||||
coroutinesError: Boolean,
|
||||
multiplatformEnable: Boolean,
|
||||
ownVersion: Int,
|
||||
coroutinesVersion: Int,
|
||||
@@ -53,9 +47,6 @@ abstract class BuildMetaInfoFactory<T : BuildMetaInfo>(private val metaInfoClass
|
||||
compilerBuildVersion = KotlinCompilerVersion.VERSION,
|
||||
languageVersionString = languageVersion.versionString,
|
||||
apiVersionString = args.apiVersion ?: languageVersion.versionString,
|
||||
coroutinesEnable = args.coroutinesState == CommonCompilerArguments.ENABLE,
|
||||
coroutinesWarn = args.coroutinesState == CommonCompilerArguments.WARN,
|
||||
coroutinesError = args.coroutinesState == CommonCompilerArguments.ERROR,
|
||||
multiplatformEnable = args.multiPlatform,
|
||||
ownVersion = OWN_VERSION,
|
||||
coroutinesVersion = COROUTINES_VERSION,
|
||||
|
||||
@@ -15,9 +15,6 @@ data class CommonBuildMetaInfo(
|
||||
override val compilerBuildVersion: String,
|
||||
override val languageVersionString: String,
|
||||
override val apiVersionString: String,
|
||||
override val coroutinesEnable: Boolean,
|
||||
override val coroutinesWarn: Boolean,
|
||||
override val coroutinesError: Boolean,
|
||||
override val multiplatformEnable: Boolean,
|
||||
override val metadataVersionMajor: Int,
|
||||
override val metadataVersionMinor: Int,
|
||||
@@ -32,9 +29,6 @@ data class CommonBuildMetaInfo(
|
||||
compilerBuildVersion: String,
|
||||
languageVersionString: String,
|
||||
apiVersionString: String,
|
||||
coroutinesEnable: Boolean,
|
||||
coroutinesWarn: Boolean,
|
||||
coroutinesError: Boolean,
|
||||
multiplatformEnable: Boolean,
|
||||
ownVersion: Int,
|
||||
coroutinesVersion: Int,
|
||||
@@ -47,9 +41,6 @@ data class CommonBuildMetaInfo(
|
||||
compilerBuildVersion = compilerBuildVersion,
|
||||
languageVersionString = languageVersionString,
|
||||
apiVersionString = apiVersionString,
|
||||
coroutinesEnable = coroutinesEnable,
|
||||
coroutinesWarn = coroutinesWarn,
|
||||
coroutinesError = coroutinesError,
|
||||
multiplatformEnable = multiplatformEnable,
|
||||
metadataVersionMajor = metadataVersion.major,
|
||||
metadataVersionMinor = metadataVersion.minor,
|
||||
|
||||
@@ -15,9 +15,6 @@ data class JsBuildMetaInfo(
|
||||
override val compilerBuildVersion: String,
|
||||
override val languageVersionString: String,
|
||||
override val apiVersionString: String,
|
||||
override val coroutinesEnable: Boolean,
|
||||
override val coroutinesWarn: Boolean,
|
||||
override val coroutinesError: Boolean,
|
||||
override val multiplatformEnable: Boolean,
|
||||
override val metadataVersionMajor: Int,
|
||||
override val metadataVersionMinor: Int,
|
||||
@@ -32,9 +29,6 @@ data class JsBuildMetaInfo(
|
||||
compilerBuildVersion: String,
|
||||
languageVersionString: String,
|
||||
apiVersionString: String,
|
||||
coroutinesEnable: Boolean,
|
||||
coroutinesWarn: Boolean,
|
||||
coroutinesError: Boolean,
|
||||
multiplatformEnable: Boolean,
|
||||
ownVersion: Int,
|
||||
coroutinesVersion: Int,
|
||||
@@ -47,9 +41,6 @@ data class JsBuildMetaInfo(
|
||||
compilerBuildVersion = compilerBuildVersion,
|
||||
languageVersionString = languageVersionString,
|
||||
apiVersionString = apiVersionString,
|
||||
coroutinesEnable = coroutinesEnable,
|
||||
coroutinesWarn = coroutinesWarn,
|
||||
coroutinesError = coroutinesError,
|
||||
multiplatformEnable = multiplatformEnable,
|
||||
metadataVersionMajor = metadataVersion.major,
|
||||
metadataVersionMinor = metadataVersion.minor,
|
||||
|
||||
@@ -27,9 +27,6 @@ data class JvmBuildMetaInfo(
|
||||
override val compilerBuildVersion: String,
|
||||
override val languageVersionString: String,
|
||||
override val apiVersionString: String,
|
||||
override val coroutinesEnable: Boolean,
|
||||
override val coroutinesWarn: Boolean,
|
||||
override val coroutinesError: Boolean,
|
||||
override val multiplatformEnable: Boolean,
|
||||
override val metadataVersionMajor: Int,
|
||||
override val metadataVersionMinor: Int,
|
||||
@@ -47,9 +44,6 @@ data class JvmBuildMetaInfo(
|
||||
compilerBuildVersion: String,
|
||||
languageVersionString: String,
|
||||
apiVersionString: String,
|
||||
coroutinesEnable: Boolean,
|
||||
coroutinesWarn: Boolean,
|
||||
coroutinesError: Boolean,
|
||||
multiplatformEnable: Boolean,
|
||||
ownVersion: Int,
|
||||
coroutinesVersion: Int,
|
||||
@@ -62,9 +56,6 @@ data class JvmBuildMetaInfo(
|
||||
compilerBuildVersion = compilerBuildVersion,
|
||||
languageVersionString = languageVersionString,
|
||||
apiVersionString = apiVersionString,
|
||||
coroutinesEnable = coroutinesEnable,
|
||||
coroutinesWarn = coroutinesWarn,
|
||||
coroutinesError = coroutinesError,
|
||||
multiplatformEnable = multiplatformEnable,
|
||||
metadataVersionMajor = metadataVersion.major,
|
||||
metadataVersionMinor = metadataVersion.minor,
|
||||
|
||||
@@ -17,19 +17,18 @@
|
||||
package org.jetbrains.kotlin.incremental
|
||||
|
||||
import com.intellij.util.containers.MultiMap
|
||||
import com.intellij.util.containers.StringInterner
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
import org.jetbrains.kotlin.incremental.components.Position
|
||||
import org.jetbrains.kotlin.incremental.components.ScopeKind
|
||||
import org.jetbrains.kotlin.incremental.storage.*
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
import org.jetbrains.kotlin.utils.createStringInterner
|
||||
import org.jetbrains.kotlin.utils.keysToMap
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.util.*
|
||||
|
||||
|
||||
open class LookupStorage(
|
||||
targetDataDir: File,
|
||||
pathConverter: FileToPathConverter
|
||||
@@ -212,8 +211,8 @@ open class LookupStorage(
|
||||
|
||||
class LookupTrackerImpl(private val delegate: LookupTracker) : LookupTracker {
|
||||
val lookups = MultiMap.createSet<LookupSymbol, String>()
|
||||
val pathInterner = StringInterner()
|
||||
private val interner = StringInterner()
|
||||
val pathInterner = createStringInterner()
|
||||
private val interner = createStringInterner()
|
||||
|
||||
override val requiresPosition: Boolean
|
||||
get() = delegate.requiresPosition
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.kotlin.build
|
||||
|
||||
import junit.framework.TestCase
|
||||
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
|
||||
import org.junit.Assert.assertNotEquals
|
||||
import org.junit.Test
|
||||
@@ -34,10 +33,7 @@ class BuildMetaInfoTest : TestCase() {
|
||||
"bytecodeVersionMinor",
|
||||
"bytecodeVersionPatch",
|
||||
"compilerBuildVersion",
|
||||
"coroutinesEnable",
|
||||
"coroutinesError",
|
||||
"coroutinesVersion",
|
||||
"coroutinesWarn",
|
||||
"isEAP",
|
||||
"languageVersionString",
|
||||
"metadataVersionMajor",
|
||||
@@ -71,14 +67,12 @@ class BuildMetaInfoTest : TestCase() {
|
||||
@Test
|
||||
fun testJvmEquals() {
|
||||
val args1 = K2JVMCompilerArguments()
|
||||
args1.coroutinesState = CommonCompilerArguments.ENABLE
|
||||
val info1 = JvmBuildMetaInfo.create(args1)
|
||||
|
||||
val args2 = K2JVMCompilerArguments()
|
||||
args2.coroutinesState = CommonCompilerArguments.WARN
|
||||
val info2 = JvmBuildMetaInfo.create(args2)
|
||||
|
||||
assertNotEquals(info1, info2)
|
||||
assertEquals(info1, info2.copy(coroutinesEnable = true, coroutinesWarn = false))
|
||||
assertEquals(info1, info2)
|
||||
assertEquals(info1, info2.copy())
|
||||
}
|
||||
}
|
||||
|
||||
+53
-7
@@ -188,13 +188,14 @@ extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
|
||||
extra["versions.ktor-network"] = "1.0.1"
|
||||
|
||||
if (!project.hasProperty("versions.kotlin-native")) {
|
||||
extra["versions.kotlin-native"] = "1.4.30-dev-17395"
|
||||
extra["versions.kotlin-native"] = "1.5-dev-17775"
|
||||
}
|
||||
|
||||
val intellijUltimateEnabled by extra(project.kotlinBuildProperties.intellijUltimateEnabled)
|
||||
val effectSystemEnabled by extra(project.getBooleanProperty("kotlin.compiler.effectSystemEnabled") ?: false)
|
||||
val newInferenceEnabled by extra(project.getBooleanProperty("kotlin.compiler.newInferenceEnabled") ?: false)
|
||||
val useJvmIrBackend by extra(project.kotlinBuildProperties.useIR)
|
||||
val useJvmFir by extra(project.kotlinBuildProperties.useFir)
|
||||
|
||||
val intellijSeparateSdks = project.getBooleanProperty("intellijSeparateSdks") ?: false
|
||||
|
||||
@@ -320,6 +321,23 @@ extra["compilerModulesForJps"] = listOf(
|
||||
":compiler:compiler.version"
|
||||
)
|
||||
|
||||
// TODO: fix remaining warnings and remove this property.
|
||||
extra["tasksWithWarnings"] = listOf(
|
||||
":kotlin-stdlib:compileTestKotlin",
|
||||
":kotlin-stdlib-jdk7:compileTestKotlin",
|
||||
":kotlin-stdlib-jdk8:compileTestKotlin",
|
||||
":compiler:frontend:compileKotlin",
|
||||
":compiler:fir:tree:compileKotlin",
|
||||
":compiler:fir:resolve:compileKotlin",
|
||||
":compiler:fir:checkers:compileKotlin",
|
||||
":compiler:fir:java:compileKotlin",
|
||||
":plugins:uast-kotlin:compileKotlin",
|
||||
":plugins:uast-kotlin:compileTestKotlin",
|
||||
":plugins:uast-kotlin-idea:compileKotlin"
|
||||
)
|
||||
|
||||
val tasksWithWarnings: List<String> by extra
|
||||
|
||||
val coreLibProjects = listOfNotNull(
|
||||
":kotlin-stdlib",
|
||||
":kotlin-stdlib-common",
|
||||
@@ -408,7 +426,6 @@ allprojects {
|
||||
jcenter()
|
||||
maven(protobufRepo)
|
||||
maven(intellijRepo)
|
||||
maven("https://dl.bintray.com/kotlin/ktor")
|
||||
maven("https://kotlin.bintray.com/kotlin-dependencies")
|
||||
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies")
|
||||
maven("https://dl.google.com/dl/android/maven2")
|
||||
@@ -446,6 +463,25 @@ allprojects {
|
||||
if (useJvmIrBackend) {
|
||||
useIR = true
|
||||
}
|
||||
|
||||
if (useJvmFir) {
|
||||
freeCompilerArgs += "-Xuse-fir"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!kotlinBuildProperties.isInJpsBuildIdeaSync) {
|
||||
// For compiler and stdlib, allWarningsAsErrors is configured in the corresponding "root" projects
|
||||
// (compiler/build.gradle.kts and libraries/commonConfiguration.gradle).
|
||||
val projectsWithWarningsAsErrors = listOf("core", "plugins").map { File(it).absoluteFile }
|
||||
if (projectsWithWarningsAsErrors.any(projectDir::startsWith)) {
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile> {
|
||||
if (path !in tasksWithWarnings) {
|
||||
kotlinOptions {
|
||||
allWarningsAsErrors = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -551,10 +587,11 @@ gradle.taskGraph.whenReady {
|
||||
|
||||
val proguardMessage = "proguard is ${kotlinBuildProperties.proguard.toOnOff()}"
|
||||
val jarCompressionMessage = "jar compression is ${kotlinBuildProperties.jarCompression.toOnOff()}"
|
||||
val profileMessage = "$profile build profile is active ($proguardMessage, $jarCompressionMessage). " +
|
||||
"Use -Pteamcity=<true|false> to reproduce CI/local build"
|
||||
|
||||
logger.warn("\n\n$profileMessage")
|
||||
logger.warn(
|
||||
"$profile build profile is active ($proguardMessage, $jarCompressionMessage). " +
|
||||
"Use -Pteamcity=<true|false> to reproduce CI/local build"
|
||||
)
|
||||
|
||||
allTasks.filterIsInstance<org.gradle.jvm.tasks.Jar>().forEach { task ->
|
||||
task.entryCompression = if (kotlinBuildProperties.jarCompression)
|
||||
@@ -777,7 +814,6 @@ tasks {
|
||||
|
||||
if (Ide.IJ()) {
|
||||
register("idea-new-project-wizard-tests") {
|
||||
dependsOn("dist")
|
||||
dependsOn(
|
||||
":libraries:tools:new-project-wizard:test",
|
||||
":libraries:tools:new-project-wizard:new-project-wizard-cli:test",
|
||||
@@ -850,7 +886,17 @@ tasks {
|
||||
":generators:test"
|
||||
)
|
||||
if (Ide.IJ()) {
|
||||
dependsOn("idea-new-project-wizard-tests")
|
||||
dependsOn(
|
||||
":libraries:tools:new-project-wizard:test",
|
||||
":libraries:tools:new-project-wizard:new-project-wizard-cli:test",
|
||||
":idea:idea-new-project-wizard:test" // Temporary here. Remove after enabling builds for ideaIntegrationsTests
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
register("ideaIntegrationsTests") {
|
||||
if (Ide.IJ()) {
|
||||
dependsOn(":idea:idea-new-project-wizard:test")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ val SourceSet.projectDefault: Project.() -> Unit
|
||||
}
|
||||
"test" -> {
|
||||
java.srcDirs("test", "tests")
|
||||
this@projectDefault.resources.srcDir("testResources")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -160,7 +160,6 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
|
||||
val item = testCases.item(i) as Element
|
||||
val failure = item.getElementsByTagName("failure")
|
||||
val name = item.getAttribute("name")
|
||||
val clazz = item.getAttribute("classname")
|
||||
|
||||
if (failure.length == 0) {
|
||||
object : TestCase(name) {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.codegen
|
||||
|
||||
@Suppress("UNUSED_PARAMETER", "unused")
|
||||
fun ClassBuilder.addRecordComponent(name: String, desc: String, signature: String?) {
|
||||
// newRecordComponent(name, desc, signature)
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.psi.KtParameter
|
||||
import org.jetbrains.kotlin.psi.KtPureClassOrObject
|
||||
import org.jetbrains.kotlin.psi.KtPureElement
|
||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.calls.components.hasDefaultValue
|
||||
import org.jetbrains.kotlin.resolve.isInlineClass
|
||||
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
|
||||
@@ -269,6 +270,7 @@ class DefaultParameterValueSubstitutor(val state: GenerationState) {
|
||||
if (classOrObject.isLocal) return false
|
||||
if (classDescriptor.isInlineClass()) return false
|
||||
if (shouldHideConstructorDueToInlineClassTypeValueParameters(constructorDescriptor)) return false
|
||||
if (DescriptorUtils.isSealedClass(classDescriptor)) return false
|
||||
|
||||
if (CodegenBinding.canHaveOuter(state.bindingContext, classDescriptor)) return false
|
||||
|
||||
|
||||
+1
-2
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.kotlin.codegen
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.util.containers.LinkedMultiMap
|
||||
import com.intellij.util.containers.MultiMap
|
||||
import org.jetbrains.kotlin.codegen.state.JvmMethodExceptionTypes
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.ConflictingJvmDeclarationsData
|
||||
@@ -49,7 +48,7 @@ abstract class SignatureCollectingClassBuilderFactory(
|
||||
|
||||
private lateinit var classInternalName: String
|
||||
|
||||
private val signatures = LinkedMultiMap<RawSignature, JvmDeclarationOrigin>()
|
||||
private val signatures = MultiMap.createLinked<RawSignature, JvmDeclarationOrigin>()
|
||||
|
||||
override fun defineClass(origin: PsiElement?, version: Int, access: Int, name: String, signature: String?, superName: String, interfaces: Array<out String>) {
|
||||
classInternalName = name
|
||||
|
||||
@@ -137,7 +137,8 @@ abstract class DefaultLambda(
|
||||
override val isSuspend = parameterDescriptor.isSuspendLambda
|
||||
|
||||
override fun generateLambdaBody(sourceCompiler: SourceCompilerForInline, reifiedTypeInliner: ReifiedTypeInliner<*>) {
|
||||
val classReader = buildClassReaderByInternalName(sourceCompiler.state, lambdaClassType.internalName)
|
||||
val classBytes = loadClassBytesByInternalName(sourceCompiler.state, lambdaClassType.internalName)
|
||||
val classReader = ClassReader(classBytes)
|
||||
var isPropertyReference = false
|
||||
var isFunctionReference = false
|
||||
classReader.accept(object : ClassVisitor(Opcodes.API_VERSION) {
|
||||
@@ -162,12 +163,7 @@ abstract class DefaultLambda(
|
||||
}
|
||||
|
||||
val descriptor = Type.getMethodDescriptor(Type.VOID_TYPE, *capturedArgs)
|
||||
val constructor = getMethodNode(
|
||||
classReader.b,
|
||||
"<init>",
|
||||
descriptor,
|
||||
lambdaClassType
|
||||
)?.node
|
||||
val constructor = getMethodNode(classBytes, "<init>", descriptor, lambdaClassType)?.node
|
||||
|
||||
assert(constructor != null || capturedArgs.isEmpty()) {
|
||||
"Can't find non-default constructor <init>$descriptor for default lambda $lambdaClassType"
|
||||
@@ -190,13 +186,8 @@ abstract class DefaultLambda(
|
||||
|
||||
val signature = mapAsmSignature(sourceCompiler)
|
||||
|
||||
node = getMethodNode(
|
||||
classReader.b,
|
||||
methodName,
|
||||
signature.descriptor,
|
||||
lambdaClassType,
|
||||
signatureAmbiguity = true
|
||||
) ?: error("Can't find method '$methodName$signature' in '${classReader.className}'")
|
||||
node = getMethodNode(classBytes, methodName, signature.descriptor, lambdaClassType, signatureAmbiguity = true)
|
||||
?: error("Can't find method '$methodName$signature' in '${classReader.className}'")
|
||||
|
||||
invokeMethod = Method(node.node.name, node.node.desc)
|
||||
|
||||
|
||||
@@ -46,9 +46,8 @@ abstract class ObjectTransformer<out T : TransformationInfo>(@JvmField val trans
|
||||
)
|
||||
}
|
||||
|
||||
fun createClassReader(): ClassReader {
|
||||
return buildClassReaderByInternalName(state, transformationInfo.oldClassName)
|
||||
}
|
||||
fun createClassReader(): ClassReader =
|
||||
ClassReader(loadClassBytesByInternalName(state, transformationInfo.oldClassName))
|
||||
}
|
||||
|
||||
class WhenMappingTransformer(
|
||||
|
||||
@@ -346,16 +346,16 @@ internal val AbstractInsnNode?.insnText: String
|
||||
internal val AbstractInsnNode?.insnOpcodeText: String
|
||||
get() = if (this == null) "null" else Printer.OPCODES[opcode]
|
||||
|
||||
internal fun buildClassReaderByInternalName(state: GenerationState, internalName: String): ClassReader {
|
||||
internal fun loadClassBytesByInternalName(state: GenerationState, internalName: String): ByteArray {
|
||||
//try to find just compiled classes then in dependencies
|
||||
val outputFile = state.factory.get(internalName + ".class")
|
||||
val outputFile = state.factory.get("$internalName.class")
|
||||
if (outputFile != null) {
|
||||
return ClassReader(outputFile.asByteArray())
|
||||
return outputFile.asByteArray()
|
||||
}
|
||||
|
||||
val file = findVirtualFileImprecise(state, internalName) ?: throw RuntimeException("Couldn't find virtual file for " + internalName)
|
||||
val file = findVirtualFileImprecise(state, internalName) ?: throw RuntimeException("Couldn't find virtual file for $internalName")
|
||||
|
||||
return ClassReader(file.contentsToByteArray())
|
||||
return file.contentsToByteArray()
|
||||
}
|
||||
|
||||
fun generateFinallyMarker(v: InstructionAdapter, depth: Int, start: Boolean) {
|
||||
|
||||
@@ -119,6 +119,20 @@ fun MethodNode.removeEmptyCatchBlocks() {
|
||||
|
||||
fun MethodNode.removeUnusedLocalVariables() {
|
||||
val used = BooleanArray(maxLocals) { false }
|
||||
|
||||
// Arguments are always used whether or not they are in the local variable table
|
||||
// or used by instructions.
|
||||
var argumentIndex = 0
|
||||
val isStatic = (access and Opcodes.ACC_STATIC) != 0
|
||||
if (!isStatic) {
|
||||
used[argumentIndex++] = true
|
||||
}
|
||||
for (argumentType in Type.getArgumentTypes(desc)) {
|
||||
for (i in 0 until argumentType.size) {
|
||||
used[argumentIndex++] = true
|
||||
}
|
||||
}
|
||||
|
||||
for (insn in instructions) {
|
||||
when (insn) {
|
||||
is VarInsnNode -> {
|
||||
|
||||
@@ -10,6 +10,8 @@ plugins {
|
||||
val compilerModules: Array<String> by rootProject.extra
|
||||
val otherCompilerModules = compilerModules.filter { it != path }
|
||||
|
||||
val tasksWithWarnings: List<String> by rootProject.extra
|
||||
|
||||
val effectSystemEnabled: Boolean by rootProject.extra
|
||||
val newInferenceEnabled: Boolean by rootProject.extra
|
||||
|
||||
@@ -85,6 +87,16 @@ if (kotlinBuildProperties.isInJpsBuildIdeaSync) {
|
||||
idea {
|
||||
this.module.generatedSourceDirs.add(generationRoot)
|
||||
}
|
||||
} else {
|
||||
allprojects {
|
||||
tasks.withType<KotlinCompile<*>> {
|
||||
if (path !in tasksWithWarnings) {
|
||||
kotlinOptions {
|
||||
allWarningsAsErrors = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
projectTest(parallel = true) {
|
||||
|
||||
@@ -57,7 +57,7 @@ tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
|
||||
kotlinOptions {
|
||||
languageVersion = "1.3"
|
||||
apiVersion = "1.3"
|
||||
freeCompilerArgs += "-Xskip-prerelease-check"
|
||||
freeCompilerArgs = freeCompilerArgs - "-progressive" + "-Xskip-prerelease-check"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-30
@@ -121,13 +121,6 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
)
|
||||
var intellijPluginRoot: String? by NullableStringFreezableVar(null)
|
||||
|
||||
@Argument(
|
||||
value = "-Xcoroutines",
|
||||
valueDescription = "{enable|warn|error}",
|
||||
description = "Enable coroutines or report warnings or errors on declarations and use sites of 'suspend' modifier"
|
||||
)
|
||||
var coroutinesState: String? by NullableStringFreezableVar(DEFAULT)
|
||||
|
||||
@Argument(
|
||||
value = "-Xnew-inference",
|
||||
description = "Enable new experimental generic type inference algorithm"
|
||||
@@ -385,17 +378,6 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
put(LanguageFeature.MultiPlatformProjects, LanguageFeature.State.ENABLED)
|
||||
}
|
||||
|
||||
when (coroutinesState) {
|
||||
CommonCompilerArguments.ERROR -> put(LanguageFeature.Coroutines, LanguageFeature.State.ENABLED_WITH_ERROR)
|
||||
CommonCompilerArguments.ENABLE -> put(LanguageFeature.Coroutines, LanguageFeature.State.ENABLED)
|
||||
CommonCompilerArguments.WARN, CommonCompilerArguments.DEFAULT -> {
|
||||
}
|
||||
else -> {
|
||||
val message = "Invalid value of -Xcoroutines (should be: enable, warn or error): " + coroutinesState
|
||||
collector.report(CompilerMessageSeverity.ERROR, message, null)
|
||||
}
|
||||
}
|
||||
|
||||
if (newInference) {
|
||||
put(LanguageFeature.NewInference, LanguageFeature.State.ENABLED)
|
||||
put(LanguageFeature.SamConversionPerArgument, LanguageFeature.State.ENABLED)
|
||||
@@ -525,7 +507,6 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
configureLanguageFeatures(collector)
|
||||
)
|
||||
|
||||
checkCoroutines(languageVersionSettings, collector)
|
||||
checkIrSupport(languageVersionSettings, collector)
|
||||
|
||||
return languageVersionSettings
|
||||
@@ -596,17 +577,6 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkCoroutines(languageVersionSettings: LanguageVersionSettings, collector: MessageCollector) {
|
||||
if (languageVersionSettings.supportsFeature(LanguageFeature.ReleaseCoroutines)) {
|
||||
if (coroutinesState != DEFAULT) {
|
||||
collector.report(
|
||||
CompilerMessageSeverity.STRONG_WARNING,
|
||||
"-Xcoroutines has no effect: coroutines are enabled anyway in 1.3 and beyond"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected open fun checkIrSupport(languageVersionSettings: LanguageVersionSettings, collector: MessageCollector) {
|
||||
// backend-specific
|
||||
}
|
||||
|
||||
+4
-3
@@ -85,8 +85,9 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
@Argument(value = "-Xuse-ir", description = "Use the IR backend")
|
||||
var useIR: Boolean by FreezableVar(false)
|
||||
|
||||
@Argument(value = "-Xno-use-ir", description = "Do not use the IR backend. Useful for a custom-built compiler where IR backend is enabled by default")
|
||||
var noUseIR: Boolean by FreezableVar(false)
|
||||
@GradleOption(DefaultValues.BooleanFalseDefault::class)
|
||||
@Argument(value = "-Xuse-old-backend", description = "Use the old JVM backend")
|
||||
var useOldBackend: Boolean by FreezableVar(false)
|
||||
|
||||
@Argument(
|
||||
value = "-Xallow-unstable-dependencies",
|
||||
@@ -462,7 +463,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
}
|
||||
|
||||
override fun checkIrSupport(languageVersionSettings: LanguageVersionSettings, collector: MessageCollector) {
|
||||
if (!useIR) return
|
||||
if (!useIR || useOldBackend) return
|
||||
|
||||
if (languageVersionSettings.languageVersion < LanguageVersion.KOTLIN_1_3
|
||||
|| languageVersionSettings.apiVersion < ApiVersion.KOTLIN_1_3
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.cli.jvm.compiler;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.io.FileUtilRt;
|
||||
import kotlin.io.FilesKt;
|
||||
import kotlin.text.StringsKt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.backend.common.output.OutputFile;
|
||||
@@ -128,16 +129,17 @@ public class CompileEnvironmentUtil {
|
||||
try (JarInputStream jis = new JarInputStream(new FileInputStream(jarPath))) {
|
||||
while (true) {
|
||||
JarEntry e = jis.getNextJarEntry();
|
||||
if (e == null) {
|
||||
break;
|
||||
if (e == null) break;
|
||||
|
||||
if (!FileUtilRt.extensionEquals(e.getName(), "class") ||
|
||||
StringsKt.substringAfterLast(e.getName(), "/", e.getName()).equals("module-info.class")) {
|
||||
continue;
|
||||
}
|
||||
if (resetJarTimestamps) {
|
||||
e.setTime(DOS_EPOCH);
|
||||
}
|
||||
if (FileUtilRt.extensionEquals(e.getName(), "class")) {
|
||||
stream.putNextEntry(e);
|
||||
FileUtil.copy(jis, stream);
|
||||
}
|
||||
stream.putNextEntry(e);
|
||||
FileUtil.copy(jis, stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -10,11 +10,10 @@ import com.intellij.codeInsight.runner.JavaMainMethodProvider;
|
||||
import com.intellij.core.JavaCoreApplicationEnvironment;
|
||||
import com.intellij.lang.MetaLanguage;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.vfs.VirtualFileSystem;
|
||||
import com.intellij.psi.FileContextProvider;
|
||||
import com.intellij.psi.augment.PsiAugmentProvider;
|
||||
import com.intellij.psi.compiled.ClassFileDecompilers;
|
||||
import com.intellij.psi.meta.MetaDataContributor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -43,7 +42,7 @@ public class KotlinCoreApplicationEnvironment extends JavaCoreApplicationEnviron
|
||||
|
||||
registerApplicationExtensionPoint(MetaLanguage.EP_NAME, MetaLanguage.class);
|
||||
|
||||
IdeaExtensionPoints.INSTANCE.registerVersionSpecificAppExtensionPoints(Extensions.getRootArea());
|
||||
IdeaExtensionPoints.INSTANCE.registerVersionSpecificAppExtensionPoints(ApplicationManager.getApplication().getExtensionArea());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -25,11 +25,11 @@ import com.intellij.ide.highlighter.JavaFileType
|
||||
import com.intellij.lang.java.JavaParserDefinition
|
||||
import com.intellij.mock.MockProject
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.application.TransactionGuard
|
||||
import com.intellij.openapi.application.TransactionGuardImpl
|
||||
import com.intellij.openapi.components.ServiceManager
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import com.intellij.openapi.extensions.Extensions
|
||||
import com.intellij.openapi.extensions.ExtensionsArea
|
||||
import com.intellij.openapi.fileTypes.PlainTextFileType
|
||||
import com.intellij.openapi.project.Project
|
||||
@@ -42,7 +42,6 @@ import com.intellij.openapi.vfs.impl.ZipHandler
|
||||
import com.intellij.pom.java.LanguageLevel
|
||||
import com.intellij.psi.PsiElementFinder
|
||||
import com.intellij.psi.PsiManager
|
||||
import com.intellij.psi.compiled.ClassFileDecompilers
|
||||
import com.intellij.psi.impl.JavaClassSupersImpl
|
||||
import com.intellij.psi.impl.PsiElementFinderImpl
|
||||
import com.intellij.psi.impl.PsiTreeChangePreprocessor
|
||||
@@ -477,11 +476,19 @@ class KotlinCoreEnvironment private constructor(
|
||||
|
||||
fun getOrCreateApplicationEnvironmentForProduction(
|
||||
parentDisposable: Disposable, configuration: CompilerConfiguration
|
||||
): KotlinCoreApplicationEnvironment = getOrCreateApplicationEnvironment(parentDisposable, configuration, unitTestMode = false)
|
||||
|
||||
fun getOrCreateApplicationEnvironmentForTests(
|
||||
parentDisposable: Disposable, configuration: CompilerConfiguration
|
||||
): KotlinCoreApplicationEnvironment = getOrCreateApplicationEnvironment(parentDisposable, configuration, unitTestMode = true)
|
||||
|
||||
private fun getOrCreateApplicationEnvironment(
|
||||
parentDisposable: Disposable, configuration: CompilerConfiguration, unitTestMode: Boolean
|
||||
): KotlinCoreApplicationEnvironment {
|
||||
synchronized(APPLICATION_LOCK) {
|
||||
if (ourApplicationEnvironment == null) {
|
||||
val disposable = Disposer.newDisposable()
|
||||
ourApplicationEnvironment = createApplicationEnvironment(disposable, configuration, unitTestMode = false)
|
||||
ourApplicationEnvironment = createApplicationEnvironment(disposable, configuration, unitTestMode)
|
||||
ourProjectCount = 0
|
||||
Disposer.register(disposable, Disposable {
|
||||
synchronized(APPLICATION_LOCK) {
|
||||
@@ -530,7 +537,7 @@ class KotlinCoreEnvironment private constructor(
|
||||
registerApplicationExtensionPointsAndExtensionsFrom(configuration, "extensions/compiler.xml")
|
||||
// FIX ME WHEN BUNCH 202 REMOVED: this code is required to support compiler bundled to both 202 and 203.
|
||||
// Please, remove "com.intellij.psi.classFileDecompiler" EP registration once 202 is no longer supported by the compiler
|
||||
if (!Extensions.getRootArea().hasExtensionPoint("com.intellij.psi.classFileDecompiler")) {
|
||||
if (!ApplicationManager.getApplication().extensionArea.hasExtensionPoint("com.intellij.psi.classFileDecompiler")) {
|
||||
registerApplicationExtensionPointsAndExtensionsFrom(configuration, "extensions/core.xml")
|
||||
}
|
||||
|
||||
@@ -564,7 +571,7 @@ class KotlinCoreEnvironment private constructor(
|
||||
CoreApplicationEnvironment.registerExtensionPointAndExtensions(
|
||||
FileSystems.getDefault().getPath(pluginRoot.path),
|
||||
configFilePath,
|
||||
Extensions.getRootArea()
|
||||
ApplicationManager.getApplication().extensionArea
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+27
-13
@@ -25,11 +25,11 @@ import com.intellij.ide.highlighter.JavaFileType
|
||||
import com.intellij.lang.java.JavaParserDefinition
|
||||
import com.intellij.mock.MockProject
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.application.TransactionGuard
|
||||
import com.intellij.openapi.application.TransactionGuardImpl
|
||||
import com.intellij.openapi.components.ServiceManager
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import com.intellij.openapi.extensions.Extensions
|
||||
import com.intellij.openapi.extensions.ExtensionsArea
|
||||
import com.intellij.openapi.fileTypes.PlainTextFileType
|
||||
import com.intellij.openapi.project.DumbUtil
|
||||
@@ -123,7 +123,7 @@ class KotlinCoreEnvironment private constructor(
|
||||
private var extensionRegistered = false
|
||||
|
||||
override fun preregisterServices() {
|
||||
registerProjectExtensionPoints(Extensions.getArea(project))
|
||||
registerProjectExtensionPoints(project.extensionArea)
|
||||
}
|
||||
|
||||
fun registerExtensionsFromPlugins(configuration: CompilerConfiguration) {
|
||||
@@ -475,11 +475,19 @@ class KotlinCoreEnvironment private constructor(
|
||||
|
||||
fun getOrCreateApplicationEnvironmentForProduction(
|
||||
parentDisposable: Disposable, configuration: CompilerConfiguration
|
||||
): KotlinCoreApplicationEnvironment = getOrCreateApplicationEnvironment(parentDisposable, configuration, unitTestMode = false)
|
||||
|
||||
fun getOrCreateApplicationEnvironmentForTests(
|
||||
parentDisposable: Disposable, configuration: CompilerConfiguration
|
||||
): KotlinCoreApplicationEnvironment = getOrCreateApplicationEnvironment(parentDisposable, configuration, unitTestMode = true)
|
||||
|
||||
private fun getOrCreateApplicationEnvironment(
|
||||
parentDisposable: Disposable, configuration: CompilerConfiguration, unitTestMode: Boolean
|
||||
): KotlinCoreApplicationEnvironment {
|
||||
synchronized(APPLICATION_LOCK) {
|
||||
if (ourApplicationEnvironment == null) {
|
||||
val disposable = Disposer.newDisposable()
|
||||
ourApplicationEnvironment = createApplicationEnvironment(disposable, configuration, unitTestMode = false)
|
||||
ourApplicationEnvironment = createApplicationEnvironment(disposable, configuration, unitTestMode)
|
||||
ourProjectCount = 0
|
||||
Disposer.register(disposable, Disposable {
|
||||
synchronized(APPLICATION_LOCK) {
|
||||
@@ -552,7 +560,7 @@ class KotlinCoreEnvironment private constructor(
|
||||
CoreApplicationEnvironment.registerExtensionPointAndExtensions(
|
||||
FileSystems.getDefault().getPath(pluginRoot.path),
|
||||
configFilePath,
|
||||
Extensions.getRootArea()
|
||||
ApplicationManager.getApplication().extensionArea
|
||||
)
|
||||
}
|
||||
|
||||
@@ -621,9 +629,9 @@ class KotlinCoreEnvironment private constructor(
|
||||
@JvmStatic
|
||||
fun registerProjectExtensionPoints(area: ExtensionsArea) {
|
||||
CoreApplicationEnvironment.registerExtensionPoint(
|
||||
area, PsiTreeChangePreprocessor.EP_NAME, PsiTreeChangePreprocessor::class.java
|
||||
area, PsiTreeChangePreprocessor.EP.name, PsiTreeChangePreprocessor::class.java
|
||||
)
|
||||
CoreApplicationEnvironment.registerExtensionPoint(area, PsiElementFinder.EP_NAME, PsiElementFinder::class.java)
|
||||
CoreApplicationEnvironment.registerExtensionPoint(area, PsiElementFinder.EP.name, PsiElementFinder::class.java)
|
||||
|
||||
IdeaExtensionPoints.registerVersionSpecificProjectExtensionPoints(area)
|
||||
}
|
||||
@@ -631,7 +639,10 @@ class KotlinCoreEnvironment private constructor(
|
||||
// made public for Upsource
|
||||
@JvmStatic
|
||||
@Deprecated("Use registerProjectServices(project) instead.", ReplaceWith("registerProjectServices(projectEnvironment.project)"))
|
||||
fun registerProjectServices(projectEnvironment: JavaCoreProjectEnvironment, messageCollector: MessageCollector?) {
|
||||
fun registerProjectServices(
|
||||
projectEnvironment: JavaCoreProjectEnvironment,
|
||||
@Suppress("UNUSED_PARAMETER") messageCollector: MessageCollector?
|
||||
) {
|
||||
registerProjectServices(projectEnvironment.project)
|
||||
}
|
||||
|
||||
@@ -666,12 +677,15 @@ class KotlinCoreEnvironment private constructor(
|
||||
@Suppress("UnstableApiUsage")
|
||||
registerService(DumbUtil::class.java, KotlinCoreDumbUtil())
|
||||
|
||||
val area = Extensions.getArea(this)
|
||||
|
||||
area.getExtensionPoint(PsiElementFinder.EP_NAME).registerExtension(JavaElementFinder(this, kotlinAsJavaSupport))
|
||||
area.getExtensionPoint(PsiElementFinder.EP_NAME).registerExtension(
|
||||
PsiElementFinderImpl(this, ServiceManager.getService(this, JavaFileManager::class.java))
|
||||
)
|
||||
// We don't pass Disposable because in some tests, we manually unregister these extensions, and that leads to LOG.error
|
||||
// exception from `ExtensionPointImpl.doRegisterExtension`, because the registered extension can no longer be found
|
||||
// when the project is being disposed.
|
||||
// For example, see the `unregisterExtension` call in `GenerationUtils.compileFilesUsingFrontendIR`.
|
||||
// TODO: refactor this to avoid registering unneeded extensions in the first place, and avoid using deprecated API.
|
||||
@Suppress("DEPRECATION")
|
||||
PsiElementFinder.EP.getPoint(project).registerExtension(JavaElementFinder(this, kotlinAsJavaSupport))
|
||||
@Suppress("DEPRECATION")
|
||||
PsiElementFinder.EP.getPoint(project).registerExtension(PsiElementFinderImpl(this))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -328,7 +328,7 @@ object KotlinToJVMBytecodeCompiler {
|
||||
project, environment.createPackagePartProvider(librariesScope)
|
||||
)
|
||||
|
||||
val moduleInfo = FirJvmModuleInfo(module.getModuleName(), listOf(librariesModuleInfo))
|
||||
val moduleInfo = FirJvmModuleInfo(module, listOf(librariesModuleInfo))
|
||||
val session = FirSessionFactory.createJavaModuleBasedSession(moduleInfo, provider, scope, project) {
|
||||
if (extendedAnalysisMode) {
|
||||
registerExtendedCommonCheckers()
|
||||
|
||||
+13
-4
@@ -91,11 +91,13 @@ object TopDownAnalyzerFacadeForJVM {
|
||||
declarationProviderFactory: (StorageManager, Collection<KtFile>) -> DeclarationProviderFactory = ::FileBasedDeclarationProviderFactory,
|
||||
sourceModuleSearchScope: GlobalSearchScope = newModuleSearchScope(project, files),
|
||||
klibList: List<KotlinLibrary> = emptyList(),
|
||||
explicitModuleDependencyList: List<ModuleDescriptorImpl> = emptyList()
|
||||
explicitModuleDependencyList: List<ModuleDescriptorImpl> = emptyList(),
|
||||
explicitModuleFriendsList: List<ModuleDescriptorImpl> = emptyList()
|
||||
): AnalysisResult {
|
||||
val container = createContainer(
|
||||
project, files, trace, configuration, packagePartProvider, declarationProviderFactory, CompilerEnvironment,
|
||||
sourceModuleSearchScope, klibList, explicitModuleDependencyList = explicitModuleDependencyList
|
||||
sourceModuleSearchScope, klibList, explicitModuleDependencyList = explicitModuleDependencyList,
|
||||
explicitModuleFriendsList = explicitModuleFriendsList
|
||||
)
|
||||
|
||||
val module = container.get<ModuleDescriptor>()
|
||||
@@ -140,7 +142,8 @@ object TopDownAnalyzerFacadeForJVM {
|
||||
sourceModuleSearchScope: GlobalSearchScope = newModuleSearchScope(project, files),
|
||||
klibList: List<KotlinLibrary> = emptyList(),
|
||||
implicitsResolutionFilter: ImplicitsExtensionsResolutionFilter? = null,
|
||||
explicitModuleDependencyList: List<ModuleDescriptorImpl> = emptyList()
|
||||
explicitModuleDependencyList: List<ModuleDescriptorImpl> = emptyList(),
|
||||
explicitModuleFriendsList: List<ModuleDescriptorImpl> = emptyList()
|
||||
): ComponentProvider {
|
||||
val jvmTarget = configuration.get(JVMConfigurationKeys.JVM_TARGET, JvmTarget.DEFAULT)
|
||||
val languageVersionSettings = configuration.languageVersionSettings
|
||||
@@ -263,9 +266,15 @@ object TopDownAnalyzerFacadeForJVM {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
addAll(explicitModuleDependencyList)
|
||||
}
|
||||
val friends = buildSet {
|
||||
if (dependencyModule != null) {
|
||||
add(dependencyModule)
|
||||
}
|
||||
addAll(explicitModuleFriendsList)
|
||||
}
|
||||
module.setDependencies(
|
||||
dependencies,
|
||||
if (dependencyModule != null) setOf(dependencyModule) else emptySet()
|
||||
friends
|
||||
)
|
||||
module.initialize(
|
||||
CompositePackageFragmentProvider(
|
||||
|
||||
@@ -20,10 +20,10 @@ import com.intellij.ide.highlighter.JavaClassFileType
|
||||
import com.intellij.ide.highlighter.JavaFileType
|
||||
import com.intellij.openapi.vfs.VfsUtilCore
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.util.containers.IntArrayList
|
||||
import gnu.trove.THashMap
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.utils.IntArrayList
|
||||
import java.util.*
|
||||
|
||||
// speeds up finding files/classes in classpath/java source roots
|
||||
@@ -45,7 +45,8 @@ class JvmDependenciesIndexImpl(_roots: List<JavaRoot>) : JvmDependenciesIndex {
|
||||
// indices of roots that are known to contain this package
|
||||
// if this list contains [1, 3, 5] then roots with indices 1, 3 and 5 are known to contain this package, 2 and 4 are known not to (no information about roots 6 or higher)
|
||||
// if this list contains maxIndex that means that all roots containing this package are known
|
||||
val rootIndices = IntArrayList(2)
|
||||
@Suppress("DEPRECATION") // TODO: fix deprecation
|
||||
val rootIndices = com.intellij.util.containers.IntArrayList(2)
|
||||
}
|
||||
|
||||
// root "Cache" object corresponds to DefaultPackage which exists in every root. Roots with non-default fqname are also listed here but
|
||||
@@ -121,7 +122,7 @@ class JvmDependenciesIndexImpl(_roots: List<JavaRoot>) : JvmDependenciesIndex {
|
||||
// NOTE: indices manipulation instead of using caches.reversed() is here for performance reasons
|
||||
for (cacheIndex in caches.lastIndex downTo 0) {
|
||||
val cacheRootIndices = caches[cacheIndex].rootIndices
|
||||
for (i in 0..cacheRootIndices.size() - 1) {
|
||||
for (i in 0 until cacheRootIndices.size()) {
|
||||
val rootIndex = cacheRootIndices[i]
|
||||
if (rootIndex <= processedRootsUpTo) continue // roots with those indices have been processed by now
|
||||
|
||||
@@ -137,7 +138,7 @@ class JvmDependenciesIndexImpl(_roots: List<JavaRoot>) : JvmDependenciesIndex {
|
||||
}
|
||||
}
|
||||
}
|
||||
processedRootsUpTo = if (cacheRootIndices.isEmpty) processedRootsUpTo else cacheRootIndices.get(cacheRootIndices.size() - 1)
|
||||
processedRootsUpTo = if (cacheRootIndices.isEmpty) processedRootsUpTo else cacheRootIndices[cacheRootIndices.size() - 1]
|
||||
}
|
||||
|
||||
if (request is FindClassRequest) {
|
||||
@@ -156,7 +157,7 @@ class JvmDependenciesIndexImpl(_roots: List<JavaRoot>) : JvmDependenciesIndex {
|
||||
cachesPath: List<Cache>
|
||||
): VirtualFile? {
|
||||
if (rootIndex >= maxIndex) {
|
||||
for (i in (fillCachesAfter + 1)..(cachesPath.size - 1)) {
|
||||
for (i in (fillCachesAfter + 1) until cachesPath.size) {
|
||||
// we all know roots that contain this package by now
|
||||
cachesPath[i].rootIndices.add(maxIndex)
|
||||
cachesPath[i].rootIndices.trimToSize()
|
||||
|
||||
@@ -165,7 +165,22 @@ fun CompilerConfiguration.configureAdvancedJvmOptions(arguments: K2JVMCompilerAr
|
||||
|
||||
put(JVMConfigurationKeys.PARAMETERS_METADATA, arguments.javaParameters)
|
||||
|
||||
val useIR = (arguments.useIR && !arguments.noUseIR) || arguments.useFir
|
||||
val useIR = arguments.useFir ||
|
||||
if (languageVersionSettings.supportsFeature(LanguageFeature.JvmIrEnabledByDefault)) {
|
||||
!arguments.useOldBackend
|
||||
} else {
|
||||
arguments.useIR && !arguments.useOldBackend
|
||||
}
|
||||
|
||||
if (arguments.useIR && arguments.useOldBackend) {
|
||||
messageCollector.report(
|
||||
STRONG_WARNING,
|
||||
"Both -Xuse-ir and -Xuse-old-backend are passed. This is an inconsistent configuration. " +
|
||||
"The compiler will use the ${if (useIR) "JVM IR" else "old JVM"} backend"
|
||||
)
|
||||
}
|
||||
messageCollector.report(LOGGING, "Using ${if (useIR) "JVM IR" else "old JVM"} backend")
|
||||
|
||||
put(JVMConfigurationKeys.IR, useIR)
|
||||
|
||||
val abiStability = JvmAbiStability.fromStringOrNull(arguments.abiStability)
|
||||
@@ -242,11 +257,9 @@ fun CompilerConfiguration.configureAdvancedJvmOptions(arguments: K2JVMCompilerAr
|
||||
}
|
||||
|
||||
fun CompilerConfiguration.configureKlibPaths(arguments: K2JVMCompilerArguments) {
|
||||
assert(arguments.useIR || arguments.klibLibraries == null) { "Klib libraries can only be used with IR backend" }
|
||||
arguments.klibLibraries?.split(File.pathSeparator.toRegex())
|
||||
?.toTypedArray()
|
||||
?.filterNot { it.isEmpty() }
|
||||
?.let { put(JVMConfigurationKeys.KLIB_PATHS, it) }
|
||||
val libraries = arguments.klibLibraries ?: return
|
||||
assert(arguments.useIR && !arguments.useOldBackend) { "Klib libraries can only be used with IR backend" }
|
||||
put(JVMConfigurationKeys.KLIB_PATHS, libraries.split(File.pathSeparator.toRegex()).filterNot(String::isEmpty))
|
||||
}
|
||||
|
||||
private val CompilerConfiguration.messageCollector: MessageCollector
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ object KotlinCompilerRunnerUtils {
|
||||
additionalJvmParams: Array<String> = arrayOf()
|
||||
): CompileServiceSession? {
|
||||
val daemonJVMOptions = configureDaemonJVMOptions(
|
||||
additionalParams = additionalJvmParams,
|
||||
*additionalJvmParams,
|
||||
inheritMemoryLimits = true,
|
||||
inheritOtherJvmOptions = false,
|
||||
inheritAdditionalProperties = true
|
||||
|
||||
@@ -19,10 +19,11 @@ package org.jetbrains.kotlin.container
|
||||
import com.intellij.util.containers.ContainerUtil
|
||||
import java.lang.reflect.*
|
||||
import java.util.*
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
private object ClassTraversalCache {
|
||||
private val cache =
|
||||
if (System.getProperty("idea.system.path") != null) ContainerUtil.newConcurrentMap<Class<*>, ClassInfo>()
|
||||
if (System.getProperty("idea.system.path") != null) ConcurrentHashMap<Class<*>, ClassInfo>()
|
||||
else ContainerUtil.createConcurrentWeakKeySoftValueMap<Class<*>, ClassInfo>()
|
||||
|
||||
fun getClassInfo(c: Class<*>): ClassInfo {
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.daemon
|
||||
|
||||
import com.intellij.util.containers.StringInterner
|
||||
import gnu.trove.THashMap
|
||||
import gnu.trove.THashSet
|
||||
import org.jetbrains.kotlin.daemon.common.DummyProfiler
|
||||
@@ -26,6 +25,7 @@ import org.jetbrains.kotlin.incremental.components.LookupInfo
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
import org.jetbrains.kotlin.incremental.components.Position
|
||||
import org.jetbrains.kotlin.incremental.components.ScopeKind
|
||||
import org.jetbrains.kotlin.utils.createStringInterner
|
||||
|
||||
class RemoteLookupTrackerClient(
|
||||
@Suppress("DEPRECATION") val facade: org.jetbrains.kotlin.daemon.common.CompilerCallbackServicesFacade,
|
||||
@@ -36,7 +36,7 @@ class RemoteLookupTrackerClient(
|
||||
|
||||
// Map: FileName -> (ScopeFqName -> Set<Name[String] | LookupInfo>)
|
||||
private val lookups = THashMap<String, MutableMap<String, MutableSet<Any>>>()
|
||||
private val interner = StringInterner()
|
||||
private val interner = createStringInterner()
|
||||
|
||||
override val requiresPosition: Boolean = profiler.withMeasure(this) { facade.lookupTracker_requiresPosition() }
|
||||
|
||||
|
||||
+2
-4
@@ -5,16 +5,14 @@
|
||||
|
||||
package org.jetbrains.kotlin.daemon.experimental
|
||||
|
||||
import com.intellij.util.containers.StringInterner
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.jetbrains.kotlin.daemon.EventManager
|
||||
import org.jetbrains.kotlin.daemon.common.*
|
||||
import org.jetbrains.kotlin.daemon.common.experimental.CompilerCallbackServicesFacadeClientSide
|
||||
import org.jetbrains.kotlin.incremental.components.LookupInfo
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
import org.jetbrains.kotlin.incremental.components.Position
|
||||
import org.jetbrains.kotlin.incremental.components.ScopeKind
|
||||
|
||||
import org.jetbrains.kotlin.utils.createStringInterner
|
||||
|
||||
class RemoteLookupTrackerClient(
|
||||
val facade: CompilerCallbackServicesFacadeAsync,
|
||||
@@ -24,7 +22,7 @@ class RemoteLookupTrackerClient(
|
||||
private val isDoNothing = runBlocking { profiler.withMeasure(this) { facade.lookupTracker_isDoNothing() } }
|
||||
|
||||
private val lookups = hashSetOf<LookupInfo>()
|
||||
private val interner = StringInterner()
|
||||
private val interner = createStringInterner()
|
||||
|
||||
override val requiresPosition: Boolean = runBlocking { profiler.withMeasure(this) { facade.lookupTracker_requiresPosition() } }
|
||||
|
||||
|
||||
@@ -20,16 +20,20 @@ dependencies {
|
||||
testApi(projectTests(":compiler:tests-common-new"))
|
||||
testApi(project(":compiler:cli"))
|
||||
testApi(project(":compiler:fir:checkers"))
|
||||
testApi(project(":compiler:fir:fir-serialization"))
|
||||
testApi(project(":compiler:fir:entrypoint"))
|
||||
testApi(project(":compiler:frontend"))
|
||||
|
||||
testApi(platform("org.junit:junit-bom:5.7.0"))
|
||||
testApi("org.junit.jupiter:junit-jupiter")
|
||||
testApi("org.junit.platform:junit-platform-commons:1.7.0")
|
||||
testApi("org.junit.platform:junit-platform-launcher:1.7.0")
|
||||
|
||||
testCompileOnly(project(":kotlin-reflect-api"))
|
||||
testRuntimeOnly(project(":kotlin-reflect"))
|
||||
testRuntimeOnly(project(":core:descriptors.runtime"))
|
||||
testRuntimeOnly(androidDxJar())
|
||||
testRuntimeOnly(project(":compiler:fir:fir2ir:jvm-backend"))
|
||||
|
||||
testImplementation(intellijCoreDep()) { includeJars("intellij-core") }
|
||||
testImplementation(intellijDep()) {
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ interface Your<R> {
|
||||
|
||||
object My : Your<Double> {
|
||||
fun <T> T.bar() {}
|
||||
fun baz()
|
||||
<!NON_ABSTRACT_FUNCTION_WITH_NO_BODY!>fun baz()<!>
|
||||
fun Boolean.gau() {}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ private class Private {
|
||||
|
||||
fun withLocals() {
|
||||
class Local {
|
||||
private fun bar()
|
||||
<!NON_ABSTRACT_FUNCTION_WITH_NO_BODY!>private fun bar()<!>
|
||||
|
||||
fun baz() {
|
||||
bar()
|
||||
|
||||
+1
-2
@@ -16,8 +16,7 @@ FILE: RedundantModalityModifierChecker.kt
|
||||
|
||||
public abstract fun foo(): R|kotlin/Unit|
|
||||
|
||||
private final fun bar(): R|kotlin/Unit| {
|
||||
}
|
||||
private final fun bar(): R|kotlin/Unit|
|
||||
|
||||
public open fun goo(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
Vendored
+4
-4
@@ -9,14 +9,14 @@ interface Interface {
|
||||
get() = 42<!>
|
||||
<!REDUNDANT_MODALITY_MODIFIER{LT}!>// Redundant
|
||||
<!REDUNDANT_MODALITY_MODIFIER{PSI}!>abstract<!> fun foo()<!>
|
||||
// error
|
||||
private final fun bar() {}
|
||||
<!PRIVATE_FUNCTION_WITH_NO_BODY{LT}!>// error
|
||||
<!PRIVATE_FUNCTION_WITH_NO_BODY{PSI}!>private<!> final fun bar()<!>
|
||||
|
||||
<!REDUNDANT_MODALITY_MODIFIER{LT}!><!REDUNDANT_MODALITY_MODIFIER{PSI}!>open<!> fun goo() {}<!>
|
||||
<!REDUNDANT_MODALITY_MODIFIER{LT}!><!REDUNDANT_MODALITY_MODIFIER{PSI}!>abstract<!> fun tar()<!>
|
||||
|
||||
// error
|
||||
abstract fun too() {}
|
||||
<!ABSTRACT_FUNCTION_WITH_BODY{LT}!>// error
|
||||
<!ABSTRACT_FUNCTION_WITH_BODY{PSI}!>abstract<!> fun too() {}<!>
|
||||
}
|
||||
interface B {
|
||||
<!REDUNDANT_MODALITY_MODIFIER{LT}!><!REDUNDANT_MODALITY_MODIFIER{PSI}!>abstract<!> var bar: Unit<!>
|
||||
|
||||
+1
-1
@@ -27,5 +27,5 @@ FILE: extensionCallableReferences.kt
|
||||
}
|
||||
public final fun test_1(): R|kotlin/Unit| {
|
||||
lval extensionValRef: R|kotlin/reflect/KProperty1<B, A>| = Q|B|::R|/extensionVal|
|
||||
lval extensionFunRef: R|kotlin/reflect/KFunction1<B, A>| = Q|B|::R|/extensionFun|
|
||||
lval extensionFunRef: R|@ExtensionFunctionType kotlin/reflect/KFunction1<B, A>| = Q|B|::R|/extensionFun|
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
interface Some {
|
||||
open fun foo()
|
||||
<!REDUNDANT_OPEN_IN_INTERFACE{LT}!><!REDUNDANT_OPEN_IN_INTERFACE{PSI}!>open<!> fun foo()<!>
|
||||
open fun bar() {}
|
||||
|
||||
open val x: Int
|
||||
<!REDUNDANT_OPEN_IN_INTERFACE{LT}!><!REDUNDANT_OPEN_IN_INTERFACE{PSI}!>open<!> val x: Int<!>
|
||||
open val y = <!PROPERTY_INITIALIZER_IN_INTERFACE!>1<!>
|
||||
open val z get() = 1
|
||||
|
||||
open var xx: Int
|
||||
<!REDUNDANT_OPEN_IN_INTERFACE{LT}!><!REDUNDANT_OPEN_IN_INTERFACE{PSI}!>open<!> var xx: Int<!>
|
||||
open var yy = <!PROPERTY_INITIALIZER_IN_INTERFACE!>1<!>
|
||||
open var zz: Int
|
||||
set(value) {
|
||||
|
||||
+3
-3
@@ -36,7 +36,7 @@ FILE: referenceToExtension.kt
|
||||
|
||||
public final fun test_1(): R|kotlin/Unit| {
|
||||
lval memberValRef: R|kotlin/reflect/KProperty1<GenericTest.B<*>, GenericTest.A<CapturedType(*)>>| = Q|GenericTest.B|::R|SubstitutionOverride</GenericTest.B.memberVal: R|GenericTest.A<CapturedType(*)>|>|
|
||||
lval memberFunRef: R|kotlin/reflect/KFunction1<GenericTest.B<*>, GenericTest.A<CapturedType(*)>>| = Q|GenericTest.B|::R|SubstitutionOverride</GenericTest.B.memberFun: R|GenericTest.A<CapturedType(*)>|>|
|
||||
lval memberFunRef: R|@ExtensionFunctionType kotlin/reflect/KFunction1<GenericTest.B<*>, GenericTest.A<CapturedType(*)>>| = Q|GenericTest.B|::R|SubstitutionOverride</GenericTest.B.memberFun: R|GenericTest.A<CapturedType(*)>|>|
|
||||
}
|
||||
|
||||
public final fun test_2(): R|kotlin/Unit| {
|
||||
@@ -82,12 +82,12 @@ FILE: referenceToExtension.kt
|
||||
|
||||
public final fun test_1(): R|kotlin/Unit| {
|
||||
lval extensionValRef: R|kotlin/reflect/KProperty1<NoGenericTest.B, NoGenericTest.A>| = Q|NoGenericTest.B|::R|/NoGenericTest.extensionVal|
|
||||
lval extensionFunRef: R|kotlin/reflect/KFunction1<NoGenericTest.B, NoGenericTest.A>| = Q|NoGenericTest.B|::R|/NoGenericTest.extensionFun|
|
||||
lval extensionFunRef: R|@ExtensionFunctionType kotlin/reflect/KFunction1<NoGenericTest.B, NoGenericTest.A>| = Q|NoGenericTest.B|::R|/NoGenericTest.extensionFun|
|
||||
}
|
||||
|
||||
public final fun test_2(): R|kotlin/Unit| {
|
||||
lval memberValRef: R|kotlin/reflect/KProperty1<NoGenericTest.B, NoGenericTest.A>| = Q|NoGenericTest.B|::R|/NoGenericTest.B.memberVal|
|
||||
lval memberFunRef: R|kotlin/reflect/KFunction1<NoGenericTest.B, NoGenericTest.A>| = Q|NoGenericTest.B|::R|/NoGenericTest.B.memberFun|
|
||||
lval memberFunRef: R|@ExtensionFunctionType kotlin/reflect/KFunction1<NoGenericTest.B, NoGenericTest.A>| = Q|NoGenericTest.B|::R|/NoGenericTest.B.memberFun|
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ class A {
|
||||
}
|
||||
|
||||
abstract class B {
|
||||
<!EXPOSED_FUNCTION_RETURN_TYPE{LT}!>fun <!EXPOSED_FUNCTION_RETURN_TYPE{PSI}!>foo<!>(str: String): A.InnerA<!>
|
||||
<!EXPOSED_FUNCTION_RETURN_TYPE{LT}, NON_ABSTRACT_FUNCTION_WITH_NO_BODY!>fun <!EXPOSED_FUNCTION_RETURN_TYPE{PSI}!>foo<!>(str: String): A.InnerA<!>
|
||||
}
|
||||
|
||||
private enum class Some {
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ FILE: moreSpecificAmbiguousExtensions.kt
|
||||
public final fun R|IB|.extFun(x: R|IA|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
lval extFun1: R|kotlin/reflect/KFunction2<IA, IB, kotlin/Unit>| = Q|IA|::R|/extFun|
|
||||
lval extFun1: R|@ExtensionFunctionType kotlin/reflect/KFunction2<IA, IB, kotlin/Unit>| = Q|IA|::R|/extFun|
|
||||
lval extFun2: <ERROR TYPE REF: No result type for initializer> = Q|IB|::<Unresolved reference: extFun>#
|
||||
}
|
||||
public final fun testWithExpectedType(): R|kotlin/Unit| {
|
||||
|
||||
+47
@@ -7,6 +7,8 @@ package org.jetbrains.kotlin.test.runners;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.junit.jupiter.api.parallel.Execution;
|
||||
import org.junit.jupiter.api.parallel.ExecutionMode;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -18,6 +20,7 @@ import java.util.regex.Pattern;
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInResolve() throws Exception {
|
||||
@@ -561,6 +564,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/arguments")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Arguments extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInArguments() throws Exception {
|
||||
@@ -745,6 +749,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/arrays")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Arrays extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInArrays() throws Exception {
|
||||
@@ -767,6 +772,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/builtins")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Builtins extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInBuiltins() throws Exception {
|
||||
@@ -783,6 +789,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/callResolution")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class CallResolution extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInCallResolution() throws Exception {
|
||||
@@ -883,6 +890,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/cfg")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Cfg extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInCfg() throws Exception {
|
||||
@@ -1043,6 +1051,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/constructors")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Constructors extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInConstructors() throws Exception {
|
||||
@@ -1059,6 +1068,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/delegates")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Delegates extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInDelegates() throws Exception {
|
||||
@@ -1105,6 +1115,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/diagnostics")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Diagnostics extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
@TestMetadata("abstractSuperCall.kt")
|
||||
@@ -1415,6 +1426,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/expresssions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Expresssions extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
@TestMetadata("access.kt")
|
||||
@@ -1790,6 +1802,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/expresssions/inference")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Inference extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInInference() throws Exception {
|
||||
@@ -1818,6 +1831,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/expresssions/invoke")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Invoke extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInInvoke() throws Exception {
|
||||
@@ -1918,6 +1932,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/expresssions/operators")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Operators extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInOperators() throws Exception {
|
||||
@@ -1947,6 +1962,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/extendedCheckers")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class ExtendedCheckers extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInExtendedCheckers() throws Exception {
|
||||
@@ -2004,6 +2020,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/extendedCheckers/canBeReplacedWithOperatorAssignment")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class CanBeReplacedWithOperatorAssignment extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInCanBeReplacedWithOperatorAssignment() throws Exception {
|
||||
@@ -2128,6 +2145,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/extendedCheckers/emptyRangeChecker")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class EmptyRangeChecker extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInEmptyRangeChecker() throws Exception {
|
||||
@@ -2150,6 +2168,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantCallOfConversionMethod")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class RedundantCallOfConversionMethod extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInRedundantCallOfConversionMethod() throws Exception {
|
||||
@@ -2280,6 +2299,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/extendedCheckers/unused")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Unused extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInUnused() throws Exception {
|
||||
@@ -2332,6 +2352,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/extendedCheckers/UselessCallOnNotNullChecker")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class UselessCallOnNotNullChecker extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInUselessCallOnNotNullChecker() throws Exception {
|
||||
@@ -2409,6 +2430,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/fromBuilder")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class FromBuilder extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInFromBuilder() throws Exception {
|
||||
@@ -2449,6 +2471,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/inference")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Inference extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInInference() throws Exception {
|
||||
@@ -2573,6 +2596,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/innerClasses")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class InnerClasses extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInInnerClasses() throws Exception {
|
||||
@@ -2607,6 +2631,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/localClasses")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class LocalClasses extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInLocalClasses() throws Exception {
|
||||
@@ -2635,6 +2660,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/multifile")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Multifile extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInMultifile() throws Exception {
|
||||
@@ -2711,6 +2737,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/overrides")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Overrides extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInOverrides() throws Exception {
|
||||
@@ -2769,6 +2796,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/problems")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Problems extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInProblems() throws Exception {
|
||||
@@ -2869,6 +2897,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/properties")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Properties extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInProperties() throws Exception {
|
||||
@@ -2915,6 +2944,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/references")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class References extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInReferences() throws Exception {
|
||||
@@ -2949,6 +2979,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/samConstructors")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class SamConstructors extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInSamConstructors() throws Exception {
|
||||
@@ -2995,6 +3026,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/samConversions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class SamConversions extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInSamConversions() throws Exception {
|
||||
@@ -3059,6 +3091,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/smartcasts")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Smartcasts extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInSmartcasts() throws Exception {
|
||||
@@ -3134,6 +3167,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Booleans extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInBooleans() throws Exception {
|
||||
@@ -3162,6 +3196,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class BoundSmartcasts extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInBoundSmartcasts() throws Exception {
|
||||
@@ -3190,6 +3225,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class ControlStructures extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInControlStructures() throws Exception {
|
||||
@@ -3230,6 +3266,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/smartcasts/lambdas")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Lambdas extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInLambdas() throws Exception {
|
||||
@@ -3258,6 +3295,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/smartcasts/loops")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Loops extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInLoops() throws Exception {
|
||||
@@ -3280,6 +3318,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/smartcasts/problems")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Problems extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInProblems() throws Exception {
|
||||
@@ -3296,6 +3335,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Receivers extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInReceivers() throws Exception {
|
||||
@@ -3330,6 +3370,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class SafeCalls extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInSafeCalls() throws Exception {
|
||||
@@ -3364,6 +3405,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/smartcasts/stability")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Stability extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInStability() throws Exception {
|
||||
@@ -3380,6 +3422,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/smartcasts/variables")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Variables extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInVariables() throws Exception {
|
||||
@@ -3403,6 +3446,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/stdlib")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Stdlib extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInStdlib() throws Exception {
|
||||
@@ -3412,6 +3456,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/stdlib/j+k")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class J_k extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInJ_k() throws Exception {
|
||||
@@ -3435,6 +3480,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/types")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Types extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInTypes() throws Exception {
|
||||
@@ -3457,6 +3503,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/visibility")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
public class Visibility extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInVisibility() throws Exception {
|
||||
|
||||
-24
@@ -32369,18 +32369,6 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutineContext.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("coroutinesDisabled.kt")
|
||||
public void testCoroutinesDisabled() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesDisabled.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("coroutinesEnabledWithWarning.kt")
|
||||
public void testCoroutinesEnabledWithWarning() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesEnabledWithWarning.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("illegalSuspendCalls.kt")
|
||||
public void testIllegalSuspendCalls() throws Exception {
|
||||
@@ -32519,12 +32507,6 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCoroutineOrReturn.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspendCoroutineOrReturn_1_2.kt")
|
||||
public void testSuspendCoroutineOrReturn_1_2() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCoroutineOrReturn_1_2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspendCovarianJavaOverride.kt")
|
||||
public void testSuspendCovarianJavaOverride() throws Exception {
|
||||
@@ -32609,12 +32591,6 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/tryCatchLambda.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unsupported.kt")
|
||||
public void testUnsupported() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/unsupported.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("usageOfResultTypeInReturnType.kt")
|
||||
public void testUsageOfResultTypeInReturnType() throws Exception {
|
||||
|
||||
+6824
-2395
File diff suppressed because it is too large
Load Diff
+4
-1
@@ -42,7 +42,10 @@ class Generator(
|
||||
.forEach { println("import $it") }
|
||||
println()
|
||||
for ((kClass, alias) in configuration.aliases) {
|
||||
println("typealias $alias = $abstractCheckerName<${kClass.simpleName}>")
|
||||
val typeParameters =
|
||||
if (kClass.typeParameters.isEmpty()) ""
|
||||
else kClass.typeParameters.joinToString(separator = ",", prefix = "<", postfix = ">") { "*" }
|
||||
println("typealias $alias = $abstractCheckerName<${kClass.simpleName}$typeParameters>")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -27,6 +27,7 @@ fun main(args: Array<String>) {
|
||||
generateCheckersComponents(generationPath, declarationPackage, "FirDeclarationChecker") {
|
||||
alias<FirDeclaration>("BasicDeclarationChecker")
|
||||
alias<FirMemberDeclaration>("MemberDeclarationChecker")
|
||||
alias<FirProperty>("PropertyChecker")
|
||||
alias<FirRegularClass>("RegularClassChecker")
|
||||
alias<FirConstructor>("ConstructorChecker")
|
||||
alias<FirFile>("FileChecker")
|
||||
|
||||
+4
@@ -19,6 +19,8 @@ internal class ComposedDeclarationCheckers : DeclarationCheckers() {
|
||||
get() = _basicDeclarationCheckers
|
||||
override val memberDeclarationCheckers: Set<FirMemberDeclarationChecker>
|
||||
get() = _memberDeclarationCheckers
|
||||
override val propertyCheckers: Set<FirPropertyChecker>
|
||||
get() = _propertyCheckers
|
||||
override val regularClassCheckers: Set<FirRegularClassChecker>
|
||||
get() = _regularClassCheckers
|
||||
override val constructorCheckers: Set<FirConstructorChecker>
|
||||
@@ -32,6 +34,7 @@ internal class ComposedDeclarationCheckers : DeclarationCheckers() {
|
||||
|
||||
private val _basicDeclarationCheckers: MutableSet<FirBasicDeclarationChecker> = mutableSetOf()
|
||||
private val _memberDeclarationCheckers: MutableSet<FirMemberDeclarationChecker> = mutableSetOf()
|
||||
private val _propertyCheckers: MutableSet<FirPropertyChecker> = mutableSetOf()
|
||||
private val _regularClassCheckers: MutableSet<FirRegularClassChecker> = mutableSetOf()
|
||||
private val _constructorCheckers: MutableSet<FirConstructorChecker> = mutableSetOf()
|
||||
private val _fileCheckers: MutableSet<FirFileChecker> = mutableSetOf()
|
||||
@@ -42,6 +45,7 @@ internal class ComposedDeclarationCheckers : DeclarationCheckers() {
|
||||
internal fun register(checkers: DeclarationCheckers) {
|
||||
_basicDeclarationCheckers += checkers.allBasicDeclarationCheckers
|
||||
_memberDeclarationCheckers += checkers.allMemberDeclarationCheckers
|
||||
_propertyCheckers += checkers.allPropertyCheckers
|
||||
_regularClassCheckers += checkers.allRegularClassCheckers
|
||||
_constructorCheckers += checkers.allConstructorCheckers
|
||||
_fileCheckers += checkers.allFileCheckers
|
||||
|
||||
+2
@@ -21,6 +21,7 @@ abstract class DeclarationCheckers {
|
||||
|
||||
open val basicDeclarationCheckers: Set<FirBasicDeclarationChecker> = emptySet()
|
||||
open val memberDeclarationCheckers: Set<FirMemberDeclarationChecker> = emptySet()
|
||||
open val propertyCheckers: Set<FirPropertyChecker> = emptySet()
|
||||
open val regularClassCheckers: Set<FirRegularClassChecker> = emptySet()
|
||||
open val constructorCheckers: Set<FirConstructorChecker> = emptySet()
|
||||
open val fileCheckers: Set<FirFileChecker> = emptySet()
|
||||
@@ -30,6 +31,7 @@ abstract class DeclarationCheckers {
|
||||
|
||||
@CheckersComponentInternal internal val allBasicDeclarationCheckers: Set<FirBasicDeclarationChecker> get() = basicDeclarationCheckers
|
||||
@CheckersComponentInternal internal val allMemberDeclarationCheckers: Set<FirMemberDeclarationChecker> get() = memberDeclarationCheckers + allBasicDeclarationCheckers
|
||||
@CheckersComponentInternal internal val allPropertyCheckers: Set<FirPropertyChecker> get() = propertyCheckers + allMemberDeclarationCheckers
|
||||
@CheckersComponentInternal internal val allRegularClassCheckers: Set<FirRegularClassChecker> get() = regularClassCheckers + allMemberDeclarationCheckers
|
||||
@CheckersComponentInternal internal val allConstructorCheckers: Set<FirConstructorChecker> get() = constructorCheckers + allMemberDeclarationCheckers
|
||||
@CheckersComponentInternal internal val allFileCheckers: Set<FirFileChecker> get() = fileCheckers + allBasicDeclarationCheckers
|
||||
|
||||
+2
@@ -14,10 +14,12 @@ import org.jetbrains.kotlin.fir.declarations.FirConstructor
|
||||
import org.jetbrains.kotlin.fir.declarations.FirDeclaration
|
||||
import org.jetbrains.kotlin.fir.declarations.FirFile
|
||||
import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration
|
||||
import org.jetbrains.kotlin.fir.declarations.FirProperty
|
||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||
|
||||
typealias FirBasicDeclarationChecker = FirDeclarationChecker<FirDeclaration>
|
||||
typealias FirMemberDeclarationChecker = FirDeclarationChecker<FirMemberDeclaration>
|
||||
typealias FirPropertyChecker = FirDeclarationChecker<FirProperty>
|
||||
typealias FirRegularClassChecker = FirDeclarationChecker<FirRegularClass>
|
||||
typealias FirConstructorChecker = FirDeclarationChecker<FirConstructor>
|
||||
typealias FirFileChecker = FirDeclarationChecker<FirFile>
|
||||
|
||||
+4
-3
@@ -29,6 +29,7 @@ import org.jetbrains.kotlin.fir.types.coneType
|
||||
import org.jetbrains.kotlin.fir.types.intersectTypesOrNull
|
||||
import org.jetbrains.kotlin.fir.types.isNullable
|
||||
import org.jetbrains.kotlin.types.AbstractTypeChecker
|
||||
import org.jetbrains.kotlin.types.ConstantValueKind
|
||||
import org.jetbrains.kotlin.types.model.KotlinTypeMarker
|
||||
import org.jetbrains.kotlin.types.model.TypeCheckerProviderContext
|
||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
@@ -183,9 +184,9 @@ object FirReturnsImpliesAnalyzer : FirControlFlowChecker() {
|
||||
}
|
||||
|
||||
private fun FirConstExpression<*>.isApplicableWith(operation: Operation): Boolean = when {
|
||||
kind == FirConstKind.Null -> operation == Operation.EqNull
|
||||
kind == FirConstKind.Boolean && operation == Operation.EqTrue -> (value as Boolean)
|
||||
kind == FirConstKind.Boolean && operation == Operation.EqFalse -> !(value as Boolean)
|
||||
kind == ConstantValueKind.Null -> operation == Operation.EqNull
|
||||
kind == ConstantValueKind.Boolean && operation == Operation.EqTrue -> (value as Boolean)
|
||||
kind == ConstantValueKind.Boolean && operation == Operation.EqFalse -> !(value as Boolean)
|
||||
else -> true
|
||||
}
|
||||
|
||||
|
||||
+2
-6
@@ -11,18 +11,14 @@ import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||
import org.jetbrains.kotlin.fir.declarations.FirConstructor
|
||||
import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration
|
||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||
import org.jetbrains.kotlin.fir.references.FirErrorNamedReference
|
||||
import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference
|
||||
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeAmbiguityError
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
|
||||
object FirCommonConstructorDelegationIssuesChecker : FirMemberDeclarationChecker() {
|
||||
override fun check(declaration: FirMemberDeclaration, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (declaration !is FirRegularClass) {
|
||||
return
|
||||
}
|
||||
object FirCommonConstructorDelegationIssuesChecker : FirRegularClassChecker() {
|
||||
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
|
||||
val cyclicConstructors = mutableSetOf<FirConstructor>()
|
||||
var hasPrimaryConstructor = false
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.fir.analysis.checkers.declaration
|
||||
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||
import org.jetbrains.kotlin.fir.declarations.isExpect
|
||||
|
||||
// Note that the class that contains the currently visiting declaration will *not* be in the context's containing declarations *yet*.
|
||||
internal fun isInsideExpectClass(containingDeclaration: FirRegularClass, context: CheckerContext): Boolean =
|
||||
containingDeclaration.isExpect || context.containingDeclarations.asReversed().any { it is FirRegularClass && it.isExpect }
|
||||
+4
-5
@@ -11,12 +11,11 @@ import org.jetbrains.kotlin.fir.FirSourceElement
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||
import org.jetbrains.kotlin.fir.declarations.FirClass
|
||||
import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration
|
||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||
|
||||
object FirDelegationInInterfaceChecker : FirMemberDeclarationChecker() {
|
||||
override fun check(declaration: FirMemberDeclaration, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (declaration !is FirClass<*> || declaration.classKind != ClassKind.INTERFACE) {
|
||||
object FirDelegationInInterfaceChecker : FirRegularClassChecker() {
|
||||
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (declaration.classKind != ClassKind.INTERFACE) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
+3
-4
@@ -12,12 +12,11 @@ import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||
import org.jetbrains.kotlin.fir.declarations.FirConstructor
|
||||
import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration
|
||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||
|
||||
object FirDelegationSuperCallInEnumConstructorChecker : FirMemberDeclarationChecker() {
|
||||
override fun check(declaration: FirMemberDeclaration, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (declaration !is FirRegularClass || declaration.classKind != ClassKind.ENUM_CLASS) {
|
||||
object FirDelegationSuperCallInEnumConstructorChecker : FirRegularClassChecker() {
|
||||
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (declaration.classKind != ClassKind.ENUM_CLASS) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.fir.analysis.checkers.declaration
|
||||
|
||||
import org.jetbrains.kotlin.KtNodeTypes
|
||||
import org.jetbrains.kotlin.fir.FirFakeSourceElementKind
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.extended.report
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||
import org.jetbrains.kotlin.fir.declarations.FirProperty
|
||||
import org.jetbrains.kotlin.fir.diagnostics.ConeSimpleDiagnostic
|
||||
import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind
|
||||
import org.jetbrains.kotlin.fir.expressions.FirErrorExpression
|
||||
|
||||
object FirDestructuringDeclarationInitializerChecker : FirPropertyChecker() {
|
||||
override fun check(declaration: FirProperty, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (!declaration.name.isSpecial || declaration.name.asString() != "<destruct>") return
|
||||
val source = declaration.source
|
||||
if (source == null || source.kind is FirFakeSourceElementKind) return
|
||||
if (source.elementType != KtNodeTypes.DESTRUCTURING_DECLARATION) return
|
||||
val needToReport =
|
||||
when (val initializer = declaration.initializer) {
|
||||
null -> true
|
||||
is FirErrorExpression -> (initializer.diagnostic as? ConeSimpleDiagnostic)?.kind == DiagnosticKind.Syntax
|
||||
else -> false
|
||||
}
|
||||
if (needToReport) {
|
||||
reporter.report(source, FirErrors.INITIALIZER_REQUIRED_FOR_DESTRUCTURING_DECLARATION)
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-5
@@ -11,12 +11,11 @@ import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.findNonInterfaceSupertype
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||
import org.jetbrains.kotlin.fir.declarations.FirClass
|
||||
import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration
|
||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||
|
||||
object FirEnumClassSimpleChecker : FirMemberDeclarationChecker() {
|
||||
override fun check(declaration: FirMemberDeclaration, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (declaration !is FirClass<*> || declaration.classKind != ClassKind.ENUM_CLASS) {
|
||||
object FirEnumClassSimpleChecker : FirRegularClassChecker() {
|
||||
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (declaration.classKind != ClassKind.ENUM_CLASS) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -16,7 +16,7 @@ import org.jetbrains.kotlin.fir.types.ConeTypeParameterType
|
||||
import org.jetbrains.kotlin.fir.types.coneType
|
||||
import org.jetbrains.kotlin.fir.types.isNullable
|
||||
|
||||
object FirInapplicableLateinitChecker : FirMemberDeclarationChecker() {
|
||||
object FirInapplicableLateinitChecker : FirPropertyChecker() {
|
||||
var primitives: Set<ConeKotlinType>? = null
|
||||
|
||||
private fun getPrimitiveTypes(context: CheckerContext) = primitives ?: mutableSetOf<ConeKotlinType>().apply {
|
||||
@@ -33,8 +33,8 @@ object FirInapplicableLateinitChecker : FirMemberDeclarationChecker() {
|
||||
primitives = this
|
||||
}
|
||||
|
||||
override fun check(declaration: FirMemberDeclaration, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (declaration !is FirProperty || !declaration.isLateInit) {
|
||||
override fun check(declaration: FirProperty, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (!declaration.isLateInit) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
+4
-5
@@ -11,12 +11,11 @@ import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.findNonInterfaceSupertype
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||
import org.jetbrains.kotlin.fir.declarations.FirClass
|
||||
import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration
|
||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||
|
||||
object FirInterfaceWithSuperclassChecker : FirMemberDeclarationChecker() {
|
||||
override fun check(declaration: FirMemberDeclaration, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (declaration !is FirClass<*> || declaration.classKind != ClassKind.INTERFACE) {
|
||||
object FirInterfaceWithSuperclassChecker : FirRegularClassChecker() {
|
||||
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (declaration.classKind != ClassKind.INTERFACE) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
+7
-6
@@ -11,21 +11,22 @@ import org.jetbrains.kotlin.descriptors.Visibilities
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||
import org.jetbrains.kotlin.fir.declarations.FirDeclaration
|
||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||
import org.jetbrains.kotlin.fir.declarations.isCompanion
|
||||
import org.jetbrains.kotlin.fir.declarations.visibility
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
object FirLocalEntityNotAllowedChecker : FirBasicDeclarationChecker() {
|
||||
override fun check(declaration: FirDeclaration, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (declaration !is FirRegularClass || declaration.visibility != Visibilities.Local) {
|
||||
object FirLocalEntityNotAllowedChecker : FirRegularClassChecker() {
|
||||
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (declaration.visibility != Visibilities.Local) {
|
||||
return
|
||||
}
|
||||
|
||||
when {
|
||||
declaration.classKind == ClassKind.OBJECT && !declaration.isCompanion -> reporter.reportLocalObjectNotAllowed(declaration.source, declaration.name)
|
||||
declaration.classKind == ClassKind.INTERFACE -> reporter.reportLocalInterfaceNotAllowed(declaration.source, declaration.name)
|
||||
declaration.classKind == ClassKind.OBJECT && !declaration.isCompanion ->
|
||||
reporter.reportLocalObjectNotAllowed(declaration.source, declaration.name)
|
||||
declaration.classKind == ClassKind.INTERFACE ->
|
||||
reporter.reportLocalInterfaceNotAllowed(declaration.source, declaration.name)
|
||||
else -> {
|
||||
}
|
||||
}
|
||||
|
||||
+2
-8
@@ -5,21 +5,15 @@
|
||||
|
||||
package org.jetbrains.kotlin.fir.analysis.checkers.declaration
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.fir.FirSourceElement
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||
import org.jetbrains.kotlin.fir.declarations.FirDeclaration
|
||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||
import org.jetbrains.kotlin.fir.declarations.isCompanion
|
||||
|
||||
object FirManyCompanionObjectsChecker : FirBasicDeclarationChecker() {
|
||||
override fun check(declaration: FirDeclaration, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (declaration !is FirRegularClass) {
|
||||
return
|
||||
}
|
||||
|
||||
object FirManyCompanionObjectsChecker : FirRegularClassChecker() {
|
||||
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
var hasCompanion = false
|
||||
|
||||
for (it in declaration.declarations) {
|
||||
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.fir.analysis.checkers.declaration
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||
import org.jetbrains.kotlin.fir.FirFakeSourceElementKind
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.extended.report
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||
import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
|
||||
// See old FE's [DeclarationsChecker]
|
||||
object FirMemberFunctionChecker : FirRegularClassChecker() {
|
||||
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
for (member in declaration.declarations) {
|
||||
if (member is FirSimpleFunction) {
|
||||
checkFunction(declaration, member, context, reporter)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkFunction(
|
||||
containingDeclaration: FirRegularClass,
|
||||
function: FirSimpleFunction,
|
||||
context: CheckerContext,
|
||||
reporter: DiagnosticReporter
|
||||
) {
|
||||
val source = function.source ?: return
|
||||
if (source.kind is FirFakeSourceElementKind) return
|
||||
// If multiple (potentially conflicting) modality modifiers are specified, not all modifiers are recorded at `status`.
|
||||
// So, our source of truth should be the full modifier list retrieved from the source.
|
||||
val modifierList = with(FirModifierList) { source.getModifierList() }
|
||||
val hasAbstractModifier = modifierList?.modifiers?.any { it.token == KtTokens.ABSTRACT_KEYWORD } == true
|
||||
val isAbstract = function.isAbstract || hasAbstractModifier
|
||||
if (isAbstract) {
|
||||
if (!containingDeclaration.canHaveAbstractDeclaration) {
|
||||
reporter.report(source, FirErrors.ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS)
|
||||
}
|
||||
if (function.hasBody) {
|
||||
reporter.report(source, FirErrors.ABSTRACT_FUNCTION_WITH_BODY)
|
||||
}
|
||||
}
|
||||
val isInsideExpectClass = isInsideExpectClass(containingDeclaration, context)
|
||||
val hasOpenModifier = modifierList?.modifiers?.any { it.token == KtTokens.OPEN_KEYWORD } == true
|
||||
val isExternal = function.isExternal || modifierList?.modifiers?.any { it.token == KtTokens.EXTERNAL_KEYWORD } == true
|
||||
if (!function.hasBody) {
|
||||
if (containingDeclaration.isInterface) {
|
||||
if (Visibilities.isPrivate(function.visibility)) {
|
||||
reporter.report(source, FirErrors.PRIVATE_FUNCTION_WITH_NO_BODY)
|
||||
}
|
||||
if (!isInsideExpectClass && !hasAbstractModifier && hasOpenModifier) {
|
||||
reporter.report(source, FirErrors.REDUNDANT_OPEN_IN_INTERFACE)
|
||||
}
|
||||
} else if (!isInsideExpectClass && !hasAbstractModifier && !isExternal) {
|
||||
reporter.report(FirErrors.NON_ABSTRACT_FUNCTION_WITH_NO_BODY.on(source, function.symbol))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+48
-29
@@ -5,7 +5,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.fir.analysis.checkers.declaration
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||
import org.jetbrains.kotlin.fir.FirSourceElement
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||
@@ -17,42 +16,50 @@ import org.jetbrains.kotlin.fir.declarations.impl.FirDefaultPropertyAccessor
|
||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertyAccessorSymbol
|
||||
import org.jetbrains.kotlin.fir.types.FirImplicitTypeRef
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
|
||||
// See old FE's [DeclarationsChecker]
|
||||
object FirMemberPropertyChecker : FirBasicDeclarationChecker() {
|
||||
override fun check(declaration: FirDeclaration, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (declaration !is FirRegularClass) {
|
||||
return
|
||||
}
|
||||
object FirMemberPropertyChecker : FirRegularClassChecker() {
|
||||
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
for (member in declaration.declarations) {
|
||||
if (member is FirProperty) {
|
||||
checkProperty(declaration, member, reporter)
|
||||
checkProperty(declaration, member, context, reporter)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkProperty(containingDeclaration: FirRegularClass, property: FirProperty, reporter: DiagnosticReporter) {
|
||||
if (inInterface(containingDeclaration) &&
|
||||
property.visibility == Visibilities.Private &&
|
||||
!property.isAbstract &&
|
||||
private fun checkProperty(
|
||||
containingDeclaration: FirRegularClass,
|
||||
property: FirProperty,
|
||||
context: CheckerContext,
|
||||
reporter: DiagnosticReporter
|
||||
) {
|
||||
// If multiple (potentially conflicting) modality modifiers are specified, not all modifiers are recorded at `status`.
|
||||
// So, our source of truth should be the full modifier list retrieved from the source.
|
||||
val modifierList = with(FirModifierList) { property.source.getModifierList() }
|
||||
val hasAbstractModifier = modifierList?.modifiers?.any { it.token == KtTokens.ABSTRACT_KEYWORD } == true
|
||||
val isAbstract = property.isAbstract || hasAbstractModifier
|
||||
if (containingDeclaration.isInterface &&
|
||||
Visibilities.isPrivate(property.visibility) &&
|
||||
!isAbstract &&
|
||||
(property.getter == null || property.getter is FirDefaultPropertyAccessor)
|
||||
) {
|
||||
property.source?.let { source ->
|
||||
reporter.report(source, FirErrors.PRIVATE_PROPERTY_IN_INTERFACE)
|
||||
property.source?.let {
|
||||
reporter.report(it, FirErrors.PRIVATE_PROPERTY_IN_INTERFACE)
|
||||
}
|
||||
}
|
||||
|
||||
if (property.isAbstract) {
|
||||
if (!containingDeclaration.isAbstract && !containingDeclaration.isSealed && !inEnumClass(containingDeclaration)) {
|
||||
property.source?.let { source ->
|
||||
reporter.report(source, FirErrors.ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS)
|
||||
if (isAbstract) {
|
||||
if (!containingDeclaration.canHaveAbstractDeclaration) {
|
||||
property.source?.let {
|
||||
reporter.report(it, FirErrors.ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (property.delegate != null) {
|
||||
property.delegate!!.source?.let {
|
||||
if (inInterface(containingDeclaration)) {
|
||||
if (containingDeclaration.isInterface) {
|
||||
reporter.report(FirErrors.DELEGATED_PROPERTY_IN_INTERFACE.on(it, property.delegate!!))
|
||||
} else {
|
||||
reporter.report(FirErrors.ABSTRACT_DELEGATED_PROPERTY.on(it, property.delegate!!))
|
||||
@@ -72,9 +79,21 @@ object FirMemberPropertyChecker : FirBasicDeclarationChecker() {
|
||||
}
|
||||
}
|
||||
|
||||
checkPropertyInitializer(containingDeclaration, property, reporter)
|
||||
checkPropertyInitializer(containingDeclaration, property, isAbstract, reporter)
|
||||
|
||||
if (property.isOpen) {
|
||||
val hasOpenModifier = modifierList?.modifiers?.any { it.token == KtTokens.OPEN_KEYWORD } == true
|
||||
if (hasOpenModifier &&
|
||||
containingDeclaration.isInterface &&
|
||||
!hasAbstractModifier &&
|
||||
property.isAbstract &&
|
||||
!isInsideExpectClass(containingDeclaration, context)
|
||||
) {
|
||||
property.source?.let {
|
||||
reporter.report(it, FirErrors.REDUNDANT_OPEN_IN_INTERFACE)
|
||||
}
|
||||
}
|
||||
val isOpen = property.isOpen || hasOpenModifier
|
||||
if (isOpen) {
|
||||
checkAccessor(property.setter, property.delegate) { src, symbol ->
|
||||
if (symbol.fir.visibility == Visibilities.Private && property.visibility != Visibilities.Private) {
|
||||
reporter.report(FirErrors.PRIVATE_SETTER_FOR_OPEN_PROPERTY.on(src, symbol))
|
||||
@@ -83,15 +102,20 @@ object FirMemberPropertyChecker : FirBasicDeclarationChecker() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkPropertyInitializer(containingDeclaration: FirRegularClass, property: FirProperty, reporter: DiagnosticReporter) {
|
||||
private fun checkPropertyInitializer(
|
||||
containingDeclaration: FirRegularClass,
|
||||
property: FirProperty,
|
||||
propertyIsAbstract: Boolean,
|
||||
reporter: DiagnosticReporter
|
||||
) {
|
||||
property.initializer?.source?.let {
|
||||
if (property.isAbstract) {
|
||||
if (propertyIsAbstract) {
|
||||
reporter.report(FirErrors.ABSTRACT_PROPERTY_WITH_INITIALIZER.on(it, property.initializer!!))
|
||||
} else if (inInterface(containingDeclaration)) {
|
||||
} else if (containingDeclaration.isInterface) {
|
||||
reporter.report(FirErrors.PROPERTY_INITIALIZER_IN_INTERFACE.on(it, property.initializer!!))
|
||||
}
|
||||
}
|
||||
if (property.isAbstract) {
|
||||
if (propertyIsAbstract) {
|
||||
if (property.initializer == null && property.delegate == null && property.returnTypeRef is FirImplicitTypeRef) {
|
||||
property.source?.let {
|
||||
reporter.report(FirErrors.PROPERTY_WITH_NO_TYPE_NO_INITIALIZER.on(it, property.symbol))
|
||||
@@ -112,9 +136,4 @@ object FirMemberPropertyChecker : FirBasicDeclarationChecker() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun inInterface(containingDeclaration: FirRegularClass): Boolean =
|
||||
containingDeclaration.classKind == ClassKind.INTERFACE
|
||||
|
||||
private fun inEnumClass(containingDeclaration: FirRegularClass): Boolean =
|
||||
containingDeclaration.classKind == ClassKind.ENUM_CLASS
|
||||
}
|
||||
|
||||
+3
-3
@@ -16,7 +16,7 @@ import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.fir.resolve.firSymbolProvider
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
|
||||
object FirMethodOfAnyImplementedInInterfaceChecker : FirMemberDeclarationChecker(), FirDeclarationPresenter {
|
||||
object FirMethodOfAnyImplementedInInterfaceChecker : FirRegularClassChecker(), FirDeclarationPresenter {
|
||||
private var inspector: FirDeclarationInspector? = null
|
||||
|
||||
private fun getInspector(context: CheckerContext) = inspector ?: FirDeclarationInspector(this).apply {
|
||||
@@ -56,8 +56,8 @@ object FirMethodOfAnyImplementedInInterfaceChecker : FirMemberDeclarationChecker
|
||||
append(')')
|
||||
}
|
||||
|
||||
override fun check(declaration: FirMemberDeclaration, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (declaration !is FirClass<*> || declaration.classKind != ClassKind.INTERFACE) {
|
||||
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (declaration.classKind != ClassKind.INTERFACE) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
-70
@@ -5,13 +5,8 @@
|
||||
|
||||
package org.jetbrains.kotlin.fir.analysis.checkers.declaration
|
||||
|
||||
import com.intellij.lang.ASTNode
|
||||
import com.intellij.lang.LighterASTNode
|
||||
import com.intellij.psi.tree.TokenSet
|
||||
import com.intellij.util.diff.FlyweightCapableTreeStructure
|
||||
import org.jetbrains.kotlin.KtNodeTypes
|
||||
import org.jetbrains.kotlin.fir.*
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.*
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||
@@ -19,8 +14,6 @@ import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.fir.declarations.impl.FirDefaultPropertyAccessor
|
||||
import org.jetbrains.kotlin.lexer.KtModifierKeywordToken
|
||||
import org.jetbrains.kotlin.lexer.KtTokens.*
|
||||
import org.jetbrains.kotlin.psi.KtModifierList
|
||||
import org.jetbrains.kotlin.psi.KtModifierListOwner
|
||||
|
||||
object FirModifierChecker : FirBasicDeclarationChecker() {
|
||||
|
||||
@@ -201,67 +194,4 @@ object FirModifierChecker : FirBasicDeclarationChecker() {
|
||||
) {
|
||||
report(FirErrors.INCOMPATIBLE_MODIFIERS.on(modifier.source, firstKeyword, secondKeyword))
|
||||
}
|
||||
|
||||
private sealed class FirModifierList {
|
||||
abstract val modifiers: List<FirModifier<*>>
|
||||
|
||||
class FirPsiModifierList(val modifierList: KtModifierList) : FirModifierList() {
|
||||
override val modifiers: List<FirModifier.FirPsiModifier>
|
||||
get() = modifierList.node.getChildren(MODIFIER_KEYWORD_SET).map { node ->
|
||||
FirModifier.FirPsiModifier(node, node.elementType as KtModifierKeywordToken)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class FirLightModifierList(
|
||||
val modifierList: LighterASTNode,
|
||||
val tree: FlyweightCapableTreeStructure<LighterASTNode>
|
||||
) : FirModifierList() {
|
||||
override val modifiers: List<FirModifier.FirLightModifier>
|
||||
get() {
|
||||
val modifierNodes = modifierList.getChildren(tree)
|
||||
return modifierNodes.filterNotNull()
|
||||
.filter { it.tokenType is KtModifierKeywordToken }
|
||||
.map { FirModifier.FirLightModifier(it, it.tokenType as KtModifierKeywordToken, tree) }
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun FirSourceElement?.getModifierList(): FirModifierList? {
|
||||
return when (this) {
|
||||
null -> null
|
||||
is FirPsiSourceElement<*> -> (psi as? KtModifierListOwner)?.modifierList?.let { FirPsiModifierList(it) }
|
||||
is FirLightSourceElement -> {
|
||||
val modifierListNode = lighterASTNode.getChildren(treeStructure).find { it?.tokenType == KtNodeTypes.MODIFIER_LIST }
|
||||
?: return null
|
||||
FirLightModifierList(modifierListNode, treeStructure)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val MODIFIER_KEYWORD_SET = TokenSet.orSet(SOFT_KEYWORDS, TokenSet.create(IN_KEYWORD, FUN_KEYWORD))
|
||||
|
||||
sealed class FirModifier<Node : Any>(val node: Node, val token: KtModifierKeywordToken) {
|
||||
|
||||
class FirPsiModifier(
|
||||
node: ASTNode,
|
||||
token: KtModifierKeywordToken
|
||||
) : FirModifier<ASTNode>(node, token) {
|
||||
override val source: FirSourceElement
|
||||
get() = node.psi.toFirPsiSourceElement()
|
||||
}
|
||||
|
||||
class FirLightModifier(
|
||||
node: LighterASTNode,
|
||||
token: KtModifierKeywordToken,
|
||||
val tree: FlyweightCapableTreeStructure<LighterASTNode>
|
||||
) : FirModifier<LighterASTNode>(node, token) {
|
||||
override val source: FirSourceElement
|
||||
get() = node.toFirLightSourceElement(tree)
|
||||
}
|
||||
|
||||
abstract val source: FirSourceElement
|
||||
}
|
||||
}
|
||||
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.fir.analysis.checkers.declaration
|
||||
|
||||
import com.intellij.lang.ASTNode
|
||||
import com.intellij.lang.LighterASTNode
|
||||
import com.intellij.psi.tree.TokenSet
|
||||
import com.intellij.util.diff.FlyweightCapableTreeStructure
|
||||
import org.jetbrains.kotlin.KtNodeTypes
|
||||
import org.jetbrains.kotlin.fir.*
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.getChildren
|
||||
import org.jetbrains.kotlin.lexer.KtModifierKeywordToken
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.psi.KtModifierList
|
||||
import org.jetbrains.kotlin.psi.KtModifierListOwner
|
||||
|
||||
// DO
|
||||
// - use this to retrieve modifiers on the source and confirm a certain modifier indeed appears
|
||||
// DON'T
|
||||
// - don't use this to report an error or warning *on* that specific modifier. Use positioning strategies instead.
|
||||
internal sealed class FirModifierList {
|
||||
abstract val modifiers: List<FirModifier<*>>
|
||||
|
||||
class FirPsiModifierList(val modifierList: KtModifierList) : FirModifierList() {
|
||||
override val modifiers: List<FirModifier.FirPsiModifier>
|
||||
get() = modifierList.node.getChildren(MODIFIER_KEYWORD_SET).map { node ->
|
||||
FirModifier.FirPsiModifier(node, node.elementType as KtModifierKeywordToken)
|
||||
}
|
||||
}
|
||||
|
||||
class FirLightModifierList(
|
||||
val modifierList: LighterASTNode,
|
||||
val tree: FlyweightCapableTreeStructure<LighterASTNode>
|
||||
) : FirModifierList() {
|
||||
override val modifiers: List<FirModifier.FirLightModifier>
|
||||
get() {
|
||||
val modifierNodes = modifierList.getChildren(tree)
|
||||
return modifierNodes.filterNotNull()
|
||||
.filter { it.tokenType is KtModifierKeywordToken }
|
||||
.map { FirModifier.FirLightModifier(it, it.tokenType as KtModifierKeywordToken, tree) }
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun FirSourceElement?.getModifierList(): FirModifierList? {
|
||||
return when (this) {
|
||||
null -> null
|
||||
is FirPsiSourceElement<*> -> (psi as? KtModifierListOwner)?.modifierList?.let { FirPsiModifierList(it) }
|
||||
is FirLightSourceElement -> {
|
||||
val modifierListNode = lighterASTNode.getChildren(treeStructure).find { it?.tokenType == KtNodeTypes.MODIFIER_LIST }
|
||||
?: return null
|
||||
FirLightModifierList(modifierListNode, treeStructure)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val MODIFIER_KEYWORD_SET = TokenSet.orSet(KtTokens.SOFT_KEYWORDS, TokenSet.create(KtTokens.IN_KEYWORD, KtTokens.FUN_KEYWORD))
|
||||
|
||||
internal sealed class FirModifier<Node : Any>(val node: Node, val token: KtModifierKeywordToken) {
|
||||
|
||||
class FirPsiModifier(
|
||||
node: ASTNode,
|
||||
token: KtModifierKeywordToken
|
||||
) : FirModifier<ASTNode>(node, token) {
|
||||
override val source: FirSourceElement
|
||||
get() = node.psi.toFirPsiSourceElement()
|
||||
}
|
||||
|
||||
class FirLightModifier(
|
||||
node: LighterASTNode,
|
||||
token: KtModifierKeywordToken,
|
||||
val tree: FlyweightCapableTreeStructure<LighterASTNode>
|
||||
) : FirModifier<LighterASTNode>(node, token) {
|
||||
override val source: FirSourceElement
|
||||
get() = node.toFirLightSourceElement(tree)
|
||||
}
|
||||
|
||||
abstract val source: FirSourceElement
|
||||
}
|
||||
+3
-4
@@ -11,13 +11,12 @@ import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||
import org.jetbrains.kotlin.fir.declarations.FirConstructor
|
||||
import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration
|
||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||
import org.jetbrains.kotlin.fir.declarations.isData
|
||||
|
||||
object FirPrimaryConstructorRequiredForDataClassChecker : FirMemberDeclarationChecker() {
|
||||
override fun check(declaration: FirMemberDeclaration, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (declaration !is FirRegularClass || declaration.classKind != ClassKind.CLASS || !declaration.isData) {
|
||||
object FirPrimaryConstructorRequiredForDataClassChecker : FirRegularClassChecker() {
|
||||
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (declaration.classKind != ClassKind.CLASS || !declaration.isData) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
+3
-4
@@ -12,12 +12,11 @@ import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||
import org.jetbrains.kotlin.fir.declarations.FirConstructor
|
||||
import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration
|
||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||
|
||||
object FirSupertypeInitializedWithoutPrimaryConstructor : FirMemberDeclarationChecker() {
|
||||
override fun check(declaration: FirMemberDeclaration, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (declaration !is FirRegularClass || declaration.classKind == ClassKind.INTERFACE) {
|
||||
object FirSupertypeInitializedWithoutPrimaryConstructor : FirRegularClassChecker() {
|
||||
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (declaration.classKind == ClassKind.INTERFACE) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
+3
-4
@@ -10,12 +10,11 @@ import org.jetbrains.kotlin.fir.FirSourceElement
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||
import org.jetbrains.kotlin.fir.declarations.FirDeclaration
|
||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||
|
||||
object FirTypeParametersInObjectChecker : FirBasicDeclarationChecker() {
|
||||
override fun check(declaration: FirDeclaration, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (declaration !is FirRegularClass || declaration.classKind != ClassKind.OBJECT) {
|
||||
object FirTypeParametersInObjectChecker : FirRegularClassChecker() {
|
||||
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (declaration.classKind != ClassKind.OBJECT) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ import com.intellij.psi.tree.IElementType
|
||||
import org.jetbrains.kotlin.KtNodeTypes
|
||||
import org.jetbrains.kotlin.fir.*
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.expression.FirExpressionChecker
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.expression.FirVariableAssignmentChecker
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.getChildren
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.psi.KtBinaryExpression
|
||||
import org.jetbrains.kotlin.psi.KtNameReferenceExpression
|
||||
|
||||
object CanBeReplacedWithOperatorAssignmentChecker : FirExpressionChecker<FirVariableAssignment>() {
|
||||
object CanBeReplacedWithOperatorAssignmentChecker : FirVariableAssignmentChecker() {
|
||||
override fun check(expression: FirVariableAssignment, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
val lValue = expression.lValue
|
||||
if (lValue !is FirResolvedNamedReference) return
|
||||
|
||||
+3
-2
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.fir.symbols.StandardClassIds
|
||||
import org.jetbrains.kotlin.fir.types.*
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.types.ConstantValueKind
|
||||
|
||||
object RedundantExplicitTypeChecker : FirMemberDeclarationChecker() {
|
||||
override fun check(declaration: FirMemberDeclaration, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
@@ -43,14 +44,14 @@ object RedundantExplicitTypeChecker : FirMemberDeclarationChecker() {
|
||||
if (!type.isSame(StandardClassIds.Boolean)) return
|
||||
}
|
||||
KtNodeTypes.INTEGER_CONSTANT -> {
|
||||
if (initializer.kind == FirConstKind.Long) {
|
||||
if (initializer.kind == ConstantValueKind.Long) {
|
||||
if (!type.isSame(StandardClassIds.Long)) return
|
||||
} else {
|
||||
if (!type.isSame(StandardClassIds.Int)) return
|
||||
}
|
||||
}
|
||||
KtNodeTypes.FLOAT_CONSTANT -> {
|
||||
if (initializer.kind == FirConstKind.Float) {
|
||||
if (initializer.kind == ConstantValueKind.Float) {
|
||||
if (!type.isSame(StandardClassIds.Float)) return
|
||||
} else {
|
||||
if (!type.isSame(StandardClassIds.Double)) return
|
||||
|
||||
-1
@@ -256,7 +256,6 @@ object UnusedChecker : FirControlFlowChecker() {
|
||||
vararg qualifiedAccesses: FirQualifiedAccess,
|
||||
): PathAwareVariableStatusInfo {
|
||||
fun retrieveSymbol(qualifiedAccess: FirQualifiedAccess): FirPropertySymbol? {
|
||||
if (qualifiedAccess.source?.kind is FirFakeSourceElementKind) return null
|
||||
val reference = qualifiedAccess.calleeReference as? FirResolvedNamedReference ?: return null
|
||||
val symbol = reference.resolvedSymbol as? FirPropertySymbol ?: return null
|
||||
return if (symbol !in localProperties) null else symbol
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ class DeclarationCheckersDiagnosticComponent(
|
||||
}
|
||||
|
||||
override fun visitProperty(property: FirProperty, data: CheckerContext) {
|
||||
checkers.memberDeclarationCheckers.check(property, data, reporter)
|
||||
(checkers.memberDeclarationCheckers + checkers.propertyCheckers).check(property, data, reporter)
|
||||
}
|
||||
|
||||
override fun visitRegularClass(regularClass: FirRegularClass, data: CheckerContext) {
|
||||
|
||||
+12
-5
@@ -14,10 +14,7 @@ import org.jetbrains.kotlin.fir.declarations.FirClass
|
||||
import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration
|
||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||
import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertyAccessorSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
||||
import org.jetbrains.kotlin.lexer.KtModifierKeywordToken
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
@@ -111,6 +108,7 @@ object FirErrors {
|
||||
val REDUNDANT_MODIFIER by error2<FirSourceElement, PsiElement, KtModifierKeywordToken, KtModifierKeywordToken>()
|
||||
val DEPRECATED_MODIFIER_PAIR by error2<FirSourceElement, PsiElement, KtModifierKeywordToken, KtModifierKeywordToken>()
|
||||
val INCOMPATIBLE_MODIFIERS by error2<FirSourceElement, PsiElement, KtModifierKeywordToken, KtModifierKeywordToken>()
|
||||
val REDUNDANT_OPEN_IN_INTERFACE by warning0<FirSourceElement, KtModifierListOwner>(SourceElementPositioningStrategies.MODALITY_MODIFIER)
|
||||
|
||||
// Applicability
|
||||
val NONE_APPLICABLE by error1<FirSourceElement, PsiElement, Collection<AbstractFirBasedSymbol<*>>>()
|
||||
@@ -149,6 +147,12 @@ object FirErrors {
|
||||
val LOCAL_OBJECT_NOT_ALLOWED by error1<FirSourceElement, KtNamedDeclaration, Name>(SourceElementPositioningStrategies.DECLARATION_NAME)
|
||||
val LOCAL_INTERFACE_NOT_ALLOWED by error1<FirSourceElement, KtNamedDeclaration, Name>(SourceElementPositioningStrategies.DECLARATION_NAME)
|
||||
|
||||
// Functions
|
||||
val ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS by error0<FirSourceElement, KtModifierListOwner>(SourceElementPositioningStrategies.MODALITY_MODIFIER)
|
||||
val ABSTRACT_FUNCTION_WITH_BODY by error0<FirSourceElement, KtModifierListOwner>(SourceElementPositioningStrategies.MODALITY_MODIFIER)
|
||||
val NON_ABSTRACT_FUNCTION_WITH_NO_BODY by error1<FirSourceElement, PsiElement, FirFunctionSymbol<*>>()
|
||||
val PRIVATE_FUNCTION_WITH_NO_BODY by error0<FirSourceElement, KtModifierListOwner>(SourceElementPositioningStrategies.VISIBILITY_MODIFIER)
|
||||
|
||||
// Properties & accessors
|
||||
val ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS by error0<FirSourceElement, KtModifierListOwner>(SourceElementPositioningStrategies.MODALITY_MODIFIER)
|
||||
val PRIVATE_PROPERTY_IN_INTERFACE by error0<FirSourceElement, KtModifierListOwner>(SourceElementPositioningStrategies.VISIBILITY_MODIFIER)
|
||||
@@ -166,11 +170,14 @@ object FirErrors {
|
||||
val PRIVATE_SETTER_FOR_ABSTRACT_PROPERTY by error1<FirSourceElement, PsiElement, FirPropertyAccessorSymbol>()
|
||||
val PRIVATE_SETTER_FOR_OPEN_PROPERTY by error1<FirSourceElement, PsiElement, FirPropertyAccessorSymbol>()
|
||||
|
||||
// Destructuring declaration
|
||||
val INITIALIZER_REQUIRED_FOR_DESTRUCTURING_DECLARATION by error0<FirSourceElement, PsiElement>()
|
||||
|
||||
// Control flow diagnostics
|
||||
val UNINITIALIZED_VARIABLE by error1<FirSourceElement, PsiElement, FirPropertySymbol>()
|
||||
val WRONG_INVOCATION_KIND by warning3<FirSourceElement, PsiElement, AbstractFirBasedSymbol<*>, EventOccurrencesRange, EventOccurrencesRange>()
|
||||
val LEAKED_IN_PLACE_LAMBDA by error1<FirSourceElement, PsiElement, AbstractFirBasedSymbol<*>>()
|
||||
val WRONG_IMPLIES_CONDITION by error0<FirSourceElement, PsiElement>()
|
||||
val WRONG_IMPLIES_CONDITION by warning0<FirSourceElement, PsiElement>()
|
||||
|
||||
// Extended checkers group
|
||||
val REDUNDANT_VISIBILITY_MODIFIER by warning0<FirSourceElement, KtModifierListOwner>(SourceElementPositioningStrategies.VISIBILITY_MODIFIER)
|
||||
|
||||
+3
-1
@@ -18,6 +18,7 @@ open class SourceElementPositioningStrategy<in E : PsiElement>(
|
||||
fun markDiagnostic(diagnostic: FirDiagnostic<*>): List<TextRange> {
|
||||
val element = diagnostic.element
|
||||
if (element is FirPsiSourceElement<*>) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return psiStrategy.mark(element.psi as E)
|
||||
}
|
||||
return lightTreeStrategy.mark(element.lighterASTNode, element.treeStructure)
|
||||
@@ -25,6 +26,7 @@ open class SourceElementPositioningStrategy<in E : PsiElement>(
|
||||
|
||||
fun isValid(element: FirSourceElement): Boolean {
|
||||
if (element is FirPsiSourceElement<*>) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return psiStrategy.isValid(element.psi as E)
|
||||
}
|
||||
return lightTreeStrategy.isValid(element.lighterASTNode, element.treeStructure)
|
||||
@@ -33,4 +35,4 @@ open class SourceElementPositioningStrategy<in E : PsiElement>(
|
||||
companion object {
|
||||
val DEFAULT: SourceElementPositioningStrategy<PsiElement> = SourceElementPositioningStrategies.DEFAULT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ data class CallableId(
|
||||
|
||||
constructor(packageName: FqName, callableName: Name) : this(packageName, null, callableName)
|
||||
|
||||
@Deprecated("TODO: Better solution for local callables?")
|
||||
@LocalCallableIdConstructor
|
||||
constructor(
|
||||
callableName: Name,
|
||||
// Currently, it's only used for debug info
|
||||
@@ -67,4 +67,5 @@ data class CallableId(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequiresOptIn("TODO: Better solution for local callables?")
|
||||
annotation class LocalCallableIdConstructor
|
||||
|
||||
@@ -34,6 +34,7 @@ class ConeAttributes private constructor(attributes: List<ConeAttribute<*>>) : A
|
||||
}
|
||||
|
||||
val Empty: ConeAttributes = ConeAttributes(emptyList())
|
||||
val WithExtensionFunctionType: ConeAttributes = ConeAttributes(listOf(CompilerConeAttributes.ExtensionFunctionType))
|
||||
internal val WithFlexibleNullability: ConeAttributes = ConeAttributes(listOf(CompilerConeAttributes.FlexibleNullability))
|
||||
|
||||
fun create(attributes: List<ConeAttribute<*>>): ConeAttributes {
|
||||
|
||||
@@ -42,6 +42,7 @@ import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.model.NewConstraintError
|
||||
import org.jetbrains.kotlin.types.AbstractStrictEqualityTypeChecker
|
||||
import org.jetbrains.kotlin.types.ConstantValueKind
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
import java.io.File
|
||||
import java.io.Writer
|
||||
@@ -761,63 +762,64 @@ class HtmlFirDump internal constructor(private var linkResolver: FirLinkResolver
|
||||
|
||||
private fun FlowContent.generate(expression: FirConstExpression<*>) {
|
||||
val value = expression.value
|
||||
if (value == null && expression.kind != FirConstKind.Null) {
|
||||
if (value == null && expression.kind != ConstantValueKind.Null) {
|
||||
return error {
|
||||
+"null value"
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalUnsignedTypes::class)
|
||||
when (expression.kind) {
|
||||
FirConstKind.Null -> keyword("null")
|
||||
FirConstKind.Boolean -> keyword(value.toString())
|
||||
FirConstKind.String, FirConstKind.Char ->
|
||||
ConstantValueKind.Null -> keyword("null")
|
||||
ConstantValueKind.Boolean -> keyword(value.toString())
|
||||
ConstantValueKind.String, ConstantValueKind.Char ->
|
||||
stringLiteral(value)
|
||||
FirConstKind.Byte -> {
|
||||
ConstantValueKind.Byte -> {
|
||||
+value.toString()
|
||||
keyword("B")
|
||||
}
|
||||
FirConstKind.Short -> {
|
||||
ConstantValueKind.Short -> {
|
||||
+value.toString()
|
||||
keyword("S")
|
||||
}
|
||||
FirConstKind.Int -> {
|
||||
ConstantValueKind.Int -> {
|
||||
+value.toString()
|
||||
keyword("I")
|
||||
}
|
||||
FirConstKind.Long -> {
|
||||
ConstantValueKind.Long -> {
|
||||
+value.toString()
|
||||
keyword("L")
|
||||
}
|
||||
FirConstKind.UnsignedByte -> {
|
||||
ConstantValueKind.UnsignedByte -> {
|
||||
+(value as Long).toUByte().toString()
|
||||
keyword("uB")
|
||||
}
|
||||
FirConstKind.UnsignedShort -> {
|
||||
ConstantValueKind.UnsignedShort -> {
|
||||
+(value as Long).toUShort().toString()
|
||||
keyword("uS")
|
||||
}
|
||||
FirConstKind.UnsignedInt -> {
|
||||
ConstantValueKind.UnsignedInt -> {
|
||||
+(value as Long).toUInt().toString()
|
||||
keyword("uI")
|
||||
}
|
||||
FirConstKind.UnsignedLong -> {
|
||||
ConstantValueKind.UnsignedLong -> {
|
||||
+(value as Long).toULong().toString()
|
||||
keyword("uL")
|
||||
}
|
||||
FirConstKind.Float -> {
|
||||
ConstantValueKind.Float -> {
|
||||
+value.toString()
|
||||
keyword("F")
|
||||
}
|
||||
FirConstKind.Double -> {
|
||||
ConstantValueKind.Double -> {
|
||||
+value.toString()
|
||||
keyword("D")
|
||||
}
|
||||
FirConstKind.IntegerLiteral -> {
|
||||
ConstantValueKind.IntegerLiteral -> {
|
||||
+"IL<"
|
||||
+value.toString()
|
||||
+">"
|
||||
}
|
||||
FirConstKind.UnsignedIntegerLiteral -> {
|
||||
ConstantValueKind.UnsignedIntegerLiteral -> {
|
||||
+"UIL<"
|
||||
+value.toString()
|
||||
+">"
|
||||
|
||||
+17
-12
@@ -17,9 +17,6 @@ object CommonDeclarationCheckers : DeclarationCheckers() {
|
||||
FirAnnotationArgumentChecker,
|
||||
FirAnnotationClassDeclarationChecker,
|
||||
FirModifierChecker,
|
||||
FirManyCompanionObjectsChecker,
|
||||
FirLocalEntityNotAllowedChecker,
|
||||
FirTypeParametersInObjectChecker,
|
||||
FirConflictsChecker,
|
||||
FirConstructorInInterfaceChecker,
|
||||
FirConflictingProjectionChecker,
|
||||
@@ -28,21 +25,29 @@ object CommonDeclarationCheckers : DeclarationCheckers() {
|
||||
override val memberDeclarationCheckers: Set<FirMemberDeclarationChecker> = setOf(
|
||||
FirInfixFunctionDeclarationChecker,
|
||||
FirExposedVisibilityDeclarationChecker,
|
||||
FirCommonConstructorDelegationIssuesChecker,
|
||||
FirSupertypeInitializedWithoutPrimaryConstructor,
|
||||
FirDelegationSuperCallInEnumConstructorChecker,
|
||||
FirPrimaryConstructorRequiredForDataClassChecker,
|
||||
FirMethodOfAnyImplementedInInterfaceChecker,
|
||||
FirSupertypeInitializedInInterfaceChecker,
|
||||
FirDelegationInInterfaceChecker,
|
||||
FirInterfaceWithSuperclassChecker,
|
||||
FirEnumClassSimpleChecker,
|
||||
FirSealedSupertypeChecker,
|
||||
)
|
||||
|
||||
override val propertyCheckers: Set<FirPropertyChecker> = setOf(
|
||||
FirInapplicableLateinitChecker,
|
||||
FirDestructuringDeclarationInitializerChecker,
|
||||
)
|
||||
|
||||
override val regularClassCheckers: Set<FirRegularClassChecker> = setOf(
|
||||
FirCommonConstructorDelegationIssuesChecker,
|
||||
FirDelegationSuperCallInEnumConstructorChecker,
|
||||
FirDelegationInInterfaceChecker,
|
||||
FirEnumClassSimpleChecker,
|
||||
FirInterfaceWithSuperclassChecker,
|
||||
FirLocalEntityNotAllowedChecker,
|
||||
FirManyCompanionObjectsChecker,
|
||||
FirMethodOfAnyImplementedInInterfaceChecker,
|
||||
FirPrimaryConstructorRequiredForDataClassChecker,
|
||||
FirSupertypeInitializedInInterfaceChecker,
|
||||
FirSupertypeInitializedWithoutPrimaryConstructor,
|
||||
FirTypeParametersInObjectChecker,
|
||||
FirTypeMismatchOnOverrideChecker,
|
||||
FirMemberFunctionChecker,
|
||||
FirMemberPropertyChecker,
|
||||
)
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ fun FirSession.registerResolveComponents() {
|
||||
@OptIn(SessionConfiguration::class)
|
||||
fun FirSession.registerJavaSpecificResolveComponents() {
|
||||
register(FirVisibilityChecker::class, FirJavaVisibilityChecker)
|
||||
register(FirModuleVisibilityChecker::class, FirJvmModuleVisibilityChecker(this))
|
||||
register(ConeCallConflictResolverFactory::class, JvmCallConflictResolverFactory)
|
||||
register(FirEffectiveVisibilityResolver::class, FirJvmEffectiveVisibilityResolver(this))
|
||||
register(FirPlatformClassMapper::class, FirJavaClassMapper(this))
|
||||
|
||||
@@ -6,23 +6,30 @@
|
||||
package org.jetbrains.kotlin.fir.session
|
||||
|
||||
import org.jetbrains.kotlin.analyzer.ModuleInfo
|
||||
import org.jetbrains.kotlin.modules.Module
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices
|
||||
|
||||
class FirJvmModuleInfo(override val name: Name, val dependencies: List<ModuleInfo>) : ModuleInfo {
|
||||
class FirJvmModuleInfo(
|
||||
override val name: Name,
|
||||
val dependencies: List<ModuleInfo> = emptyList(),
|
||||
val friendPaths: List<String> = emptyList(),
|
||||
val outputDirectory: String? = null
|
||||
) : ModuleInfo {
|
||||
companion object {
|
||||
val LIBRARIES_MODULE_NAME = Name.special("<dependencies>")
|
||||
|
||||
fun createForLibraries(mainModuleName: String? = null): FirJvmModuleInfo {
|
||||
val name = mainModuleName?.let { Name.special("<dependencies of $it>") } ?: LIBRARIES_MODULE_NAME
|
||||
return FirJvmModuleInfo(name, emptyList())
|
||||
return FirJvmModuleInfo(name)
|
||||
}
|
||||
}
|
||||
|
||||
constructor(moduleName: String, dependencies: List<ModuleInfo>) : this(Name.identifier(moduleName), dependencies)
|
||||
constructor(module: Module, dependencies: List<ModuleInfo>) :
|
||||
this(Name.identifier(module.getModuleName()), dependencies, module.getFriendPaths(), module.getOutputDirectory())
|
||||
|
||||
override val platform: TargetPlatform
|
||||
get() = JvmPlatforms.unspecifiedJvmPlatform
|
||||
@@ -30,7 +37,6 @@ class FirJvmModuleInfo(override val name: Name, val dependencies: List<ModuleInf
|
||||
override val analyzerServices: PlatformDependentAnalyzerServices
|
||||
get() = JvmPlatformAnalyzerServices
|
||||
|
||||
override fun dependencies(): List<ModuleInfo> {
|
||||
return dependencies
|
||||
}
|
||||
override fun dependencies(): List<ModuleInfo> =
|
||||
dependencies
|
||||
}
|
||||
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.fir.session
|
||||
|
||||
import com.intellij.openapi.vfs.StandardFileSystems
|
||||
import com.intellij.openapi.vfs.VfsUtilCore
|
||||
import org.jetbrains.kotlin.fir.FirModuleVisibilityChecker
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration
|
||||
import org.jetbrains.kotlin.fir.declarations.containerSource
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmPackagePartSource
|
||||
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinarySourceElement
|
||||
import org.jetbrains.kotlin.load.kotlin.VirtualFileKotlinClass
|
||||
import java.nio.file.Paths
|
||||
|
||||
class FirJvmModuleVisibilityChecker(private val session: FirSession) : FirModuleVisibilityChecker {
|
||||
override fun isInFriendModule(declaration: FirMemberDeclaration): Boolean {
|
||||
val moduleInfo = session.moduleInfo as? FirJvmModuleInfo ?: return false
|
||||
val binaryClass = when (val source = declaration.containerSource) {
|
||||
is KotlinJvmBinarySourceElement -> source.binaryClass
|
||||
is JvmPackagePartSource -> source.knownJvmBinaryClass
|
||||
else -> null
|
||||
} as? VirtualFileKotlinClass ?: return false
|
||||
// For incremental compilation, the already compiled part of the module should be accessible.
|
||||
return moduleInfo.friendPaths.any { binaryClass.isIn(it) } || moduleInfo.outputDirectory?.let { binaryClass.isIn(it) } == true
|
||||
}
|
||||
|
||||
private fun VirtualFileKotlinClass.isIn(jarOrDirectory: String): Boolean =
|
||||
when (file.fileSystem.protocol) {
|
||||
StandardFileSystems.FILE_PROTOCOL ->
|
||||
VfsUtilCore.virtualToIoFile(file).toPath().startsWith(jarOrDirectory)
|
||||
StandardFileSystems.JAR_PROTOCOL ->
|
||||
VfsUtilCore.getVirtualFileForJar(file)?.let(VfsUtilCore::virtualToIoFile)?.toPath() == Paths.get(jarOrDirectory)
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
+11
-10
@@ -36,6 +36,7 @@ import org.jetbrains.kotlin.serialization.deserialization.builtins.BuiltInSerial
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||
import org.jetbrains.kotlin.serialization.deserialization.getClassId
|
||||
import org.jetbrains.kotlin.serialization.deserialization.getName
|
||||
import org.jetbrains.kotlin.types.ConstantValueKind
|
||||
|
||||
abstract class AbstractAnnotationDeserializer(
|
||||
private val session: FirSession
|
||||
@@ -222,30 +223,30 @@ abstract class AbstractAnnotationDeserializer(
|
||||
|
||||
return when (value.type) {
|
||||
BYTE -> {
|
||||
val kind = if (isUnsigned) FirConstKind.UnsignedByte else FirConstKind.Byte
|
||||
val kind = if (isUnsigned) ConstantValueKind.UnsignedByte else ConstantValueKind.Byte
|
||||
const(kind, value.intValue.toByte())
|
||||
}
|
||||
|
||||
SHORT -> {
|
||||
val kind = if (isUnsigned) FirConstKind.UnsignedShort else FirConstKind.Short
|
||||
val kind = if (isUnsigned) ConstantValueKind.UnsignedShort else ConstantValueKind.Short
|
||||
const(kind, value.intValue.toShort())
|
||||
}
|
||||
|
||||
INT -> {
|
||||
val kind = if (isUnsigned) FirConstKind.UnsignedInt else FirConstKind.Int
|
||||
val kind = if (isUnsigned) ConstantValueKind.UnsignedInt else ConstantValueKind.Int
|
||||
const(kind, value.intValue.toInt())
|
||||
}
|
||||
|
||||
LONG -> {
|
||||
val kind = if (isUnsigned) FirConstKind.UnsignedLong else FirConstKind.Long
|
||||
val kind = if (isUnsigned) ConstantValueKind.UnsignedLong else ConstantValueKind.Long
|
||||
const(kind, value.intValue)
|
||||
}
|
||||
|
||||
CHAR -> const(FirConstKind.Char, value.intValue.toChar())
|
||||
FLOAT -> const(FirConstKind.Float, value.floatValue)
|
||||
DOUBLE -> const(FirConstKind.Double, value.doubleValue)
|
||||
BOOLEAN -> const(FirConstKind.Boolean, (value.intValue != 0L))
|
||||
STRING -> const(FirConstKind.String, nameResolver.getString(value.stringValue))
|
||||
CHAR -> const(ConstantValueKind.Char, value.intValue.toChar())
|
||||
FLOAT -> const(ConstantValueKind.Float, value.floatValue)
|
||||
DOUBLE -> const(ConstantValueKind.Double, value.doubleValue)
|
||||
BOOLEAN -> const(ConstantValueKind.Boolean, (value.intValue != 0L))
|
||||
STRING -> const(ConstantValueKind.String, nameResolver.getString(value.stringValue))
|
||||
ANNOTATION -> deserializeAnnotation(value.annotation, nameResolver)
|
||||
CLASS -> buildGetClassCall {
|
||||
val classId = nameResolver.getClassId(value.classId)
|
||||
@@ -294,5 +295,5 @@ abstract class AbstractAnnotationDeserializer(
|
||||
}
|
||||
}
|
||||
|
||||
private fun <T> const(kind: FirConstKind<T>, value: T) = buildConstExpression(null, kind, value)
|
||||
private fun <T> const(kind: ConstantValueKind<T>, value: T) = buildConstExpression(null, kind, value)
|
||||
}
|
||||
|
||||
+10
-10
@@ -6,7 +6,6 @@
|
||||
package org.jetbrains.kotlin.fir.deserialization
|
||||
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.expressions.FirConstKind
|
||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||
import org.jetbrains.kotlin.fir.expressions.builder.buildConstExpression
|
||||
import org.jetbrains.kotlin.fir.symbols.CallableId
|
||||
@@ -17,6 +16,7 @@ import org.jetbrains.kotlin.metadata.deserialization.NameResolver
|
||||
import org.jetbrains.kotlin.metadata.deserialization.getExtensionOrNull
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.serialization.deserialization.builtins.BuiltInSerializerProtocol
|
||||
import org.jetbrains.kotlin.types.ConstantValueKind
|
||||
|
||||
class FirConstDeserializer(
|
||||
val session: FirSession,
|
||||
@@ -53,16 +53,16 @@ class FirConstDeserializer(
|
||||
protoValue: ProtoBuf.Annotation.Argument.Value?, sourceValue: Any?, constKind: String, nameResolver: NameResolver
|
||||
): FirExpression? {
|
||||
return when (constKind) {
|
||||
"BYTE", "B" -> buildConstExpression(null, FirConstKind.Byte, ((protoValue?.intValue ?: sourceValue) as Number).toByte())
|
||||
"CHAR", "C" -> buildConstExpression(null, FirConstKind.Char, ((protoValue?.intValue ?: sourceValue) as Number).toChar())
|
||||
"SHORT", "S" -> buildConstExpression(null, FirConstKind.Short, ((protoValue?.intValue ?: sourceValue) as Number).toShort())
|
||||
"INT", "I" -> buildConstExpression(null, FirConstKind.Int, protoValue?.intValue?.toInt() ?: sourceValue as Int)
|
||||
"LONG", "J" -> buildConstExpression(null, FirConstKind.Long, protoValue?.intValue ?: sourceValue as Long)
|
||||
"FLOAT", "F" -> buildConstExpression(null, FirConstKind.Float, protoValue?.floatValue ?: sourceValue as Float)
|
||||
"DOUBLE", "D" -> buildConstExpression(null, FirConstKind.Double, protoValue?.doubleValue ?: sourceValue as Double)
|
||||
"BOOLEAN", "Z" -> buildConstExpression(null, FirConstKind.Boolean, (protoValue?.intValue?.toInt() ?: sourceValue) != 0)
|
||||
"BYTE", "B" -> buildConstExpression(null, ConstantValueKind.Byte, ((protoValue?.intValue ?: sourceValue) as Number).toByte())
|
||||
"CHAR", "C" -> buildConstExpression(null, ConstantValueKind.Char, ((protoValue?.intValue ?: sourceValue) as Number).toChar())
|
||||
"SHORT", "S" -> buildConstExpression(null, ConstantValueKind.Short, ((protoValue?.intValue ?: sourceValue) as Number).toShort())
|
||||
"INT", "I" -> buildConstExpression(null, ConstantValueKind.Int, protoValue?.intValue?.toInt() ?: sourceValue as Int)
|
||||
"LONG", "J" -> buildConstExpression(null, ConstantValueKind.Long, protoValue?.intValue ?: sourceValue as Long)
|
||||
"FLOAT", "F" -> buildConstExpression(null, ConstantValueKind.Float, protoValue?.floatValue ?: sourceValue as Float)
|
||||
"DOUBLE", "D" -> buildConstExpression(null, ConstantValueKind.Double, protoValue?.doubleValue ?: sourceValue as Double)
|
||||
"BOOLEAN", "Z" -> buildConstExpression(null, ConstantValueKind.Boolean, (protoValue?.intValue?.toInt() ?: sourceValue) != 0)
|
||||
"STRING", "Ljava/lang/String;" -> buildConstExpression(
|
||||
null, FirConstKind.String, protoValue?.stringValue?.let { nameResolver.getString(it) } ?: sourceValue as String
|
||||
null, ConstantValueKind.String, protoValue?.stringValue?.let { nameResolver.getString(it) } ?: sourceValue as String
|
||||
)
|
||||
else -> null
|
||||
}
|
||||
|
||||
+1
@@ -449,6 +449,7 @@ class FirMemberDeserializer(private val c: FirDeserializationContext) {
|
||||
)
|
||||
annotations +=
|
||||
c.annotationDeserializer.loadConstructorAnnotations(c.containerSource, proto, local.nameResolver, local.typeTable)
|
||||
containerSource = c.containerSource
|
||||
}.build().apply {
|
||||
containingClassAttr = c.dispatchReceiver!!.lookupTag
|
||||
versionRequirementsTable = c.versionRequirementTable
|
||||
|
||||
+17
-1
@@ -48,7 +48,8 @@ import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.getOrPut
|
||||
import java.io.InputStream
|
||||
|
||||
@NoMutableState
|
||||
//TODO make thread safe
|
||||
@ThreadSafeMutableState
|
||||
class FirBuiltinSymbolProvider(session: FirSession, val kotlinScopeProvider: KotlinScopeProvider) : FirSymbolProvider(session) {
|
||||
|
||||
private data class SyntheticFunctionalInterfaceSymbolKey(val kind: FunctionClassKind, val arity: Int)
|
||||
@@ -237,6 +238,17 @@ class FirBuiltinSymbolProvider(session: FirSession, val kotlinScopeProvider: Kot
|
||||
}
|
||||
}
|
||||
|
||||
@FirSymbolProviderInternals
|
||||
override fun getTopLevelFunctionSymbolsTo(destination: MutableList<FirNamedFunctionSymbol>, packageFqName: FqName, name: Name) {
|
||||
allPackageFragments[packageFqName]?.flatMapTo(destination) {
|
||||
it.getTopLevelFunctionSymbols(name)
|
||||
}
|
||||
}
|
||||
|
||||
@FirSymbolProviderInternals
|
||||
override fun getTopLevelPropertySymbolsTo(destination: MutableList<FirPropertySymbol>, packageFqName: FqName, name: Name) {
|
||||
}
|
||||
|
||||
private class BuiltInsPackageFragment(
|
||||
stream: InputStream, val fqName: FqName, val session: FirSession,
|
||||
val kotlinScopeProvider: KotlinScopeProvider,
|
||||
@@ -297,6 +309,10 @@ class FirBuiltinSymbolProvider(session: FirSession, val kotlinScopeProvider: Kot
|
||||
}
|
||||
|
||||
fun getTopLevelCallableSymbols(name: Name): List<FirCallableSymbol<*>> {
|
||||
return getTopLevelFunctionSymbols(name)
|
||||
}
|
||||
|
||||
fun getTopLevelFunctionSymbols(name: Name): List<FirNamedFunctionSymbol> {
|
||||
return packageProto.`package`.functionList.filter { nameResolver.getName(it.name) == name }.map {
|
||||
memberDeserializer.loadFunction(it).symbol
|
||||
}
|
||||
|
||||
+15
-14
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.fir.types.classId
|
||||
import org.jetbrains.kotlin.fir.types.coneType
|
||||
import org.jetbrains.kotlin.fir.types.coneTypeUnsafe
|
||||
import org.jetbrains.kotlin.fir.visitors.FirDefaultVisitor
|
||||
import org.jetbrains.kotlin.types.ConstantValueKind
|
||||
|
||||
internal fun FirExpression.toConstantValue(): ConstantValue<*>? = accept(FirToConstantValueTransformer, null)
|
||||
|
||||
@@ -30,20 +31,20 @@ internal object FirToConstantValueTransformer : FirDefaultVisitor<ConstantValue<
|
||||
): ConstantValue<*>? {
|
||||
val value = constExpression.value
|
||||
return when (constExpression.kind) {
|
||||
FirConstKind.Boolean -> BooleanValue(value as Boolean)
|
||||
FirConstKind.Char -> CharValue(value as Char)
|
||||
FirConstKind.Byte -> ByteValue(value as Byte)
|
||||
FirConstKind.UnsignedByte -> UByteValue(value as Byte)
|
||||
FirConstKind.Short -> ShortValue(value as Short)
|
||||
FirConstKind.UnsignedShort -> UShortValue(value as Short)
|
||||
FirConstKind.Int -> IntValue(value as Int)
|
||||
FirConstKind.UnsignedInt -> UIntValue(value as Int)
|
||||
FirConstKind.Long -> LongValue(value as Long)
|
||||
FirConstKind.UnsignedLong -> ULongValue(value as Long)
|
||||
FirConstKind.String -> StringValue(value as String)
|
||||
FirConstKind.Float -> FloatValue(value as Float)
|
||||
FirConstKind.Double -> DoubleValue(value as Double)
|
||||
FirConstKind.Null -> NullValue
|
||||
ConstantValueKind.Boolean -> BooleanValue(value as Boolean)
|
||||
ConstantValueKind.Char -> CharValue(value as Char)
|
||||
ConstantValueKind.Byte -> ByteValue(value as Byte)
|
||||
ConstantValueKind.UnsignedByte -> UByteValue(value as Byte)
|
||||
ConstantValueKind.Short -> ShortValue(value as Short)
|
||||
ConstantValueKind.UnsignedShort -> UShortValue(value as Short)
|
||||
ConstantValueKind.Int -> IntValue(value as Int)
|
||||
ConstantValueKind.UnsignedInt -> UIntValue(value as Int)
|
||||
ConstantValueKind.Long -> LongValue(value as Long)
|
||||
ConstantValueKind.UnsignedLong -> ULongValue(value as Long)
|
||||
ConstantValueKind.String -> StringValue(value as String)
|
||||
ConstantValueKind.Float -> FloatValue(value as Float)
|
||||
ConstantValueKind.Double -> DoubleValue(value as Double)
|
||||
ConstantValueKind.Null -> NullValue
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import org.jetbrains.kotlin.fir.*
|
||||
import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticProperty
|
||||
import org.jetbrains.kotlin.fir.expressions.FirConstExpression
|
||||
import org.jetbrains.kotlin.fir.expressions.FirConstKind
|
||||
import org.jetbrains.kotlin.fir.references.FirReference
|
||||
import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference
|
||||
import org.jetbrains.kotlin.fir.references.FirThisReference
|
||||
@@ -49,6 +48,7 @@ import org.jetbrains.kotlin.ir.util.functions
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
||||
import org.jetbrains.kotlin.psi.psiUtil.startOffsetSkippingComments
|
||||
import org.jetbrains.kotlin.types.ConstantValueKind
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||
|
||||
@@ -163,7 +163,7 @@ private fun FirCallableSymbol<*>.toSymbolForCall(declarationStorage: Fir2IrDecla
|
||||
}
|
||||
|
||||
fun FirConstExpression<*>.getIrConstKind(): IrConstKind<*> = when (kind) {
|
||||
FirConstKind.IntegerLiteral -> {
|
||||
ConstantValueKind.IntegerLiteral -> {
|
||||
val type = typeRef.coneTypeUnsafe<ConeIntegerLiteralType>()
|
||||
type.getApproximatedType().toConstKind()!!.toIrConstKind()
|
||||
}
|
||||
@@ -194,25 +194,25 @@ fun <T> FirConstExpression<T>.toIrConst(irType: IrType): IrConst<T> {
|
||||
}
|
||||
}
|
||||
|
||||
private fun FirConstKind<*>.toIrConstKind(): IrConstKind<*> = when (this) {
|
||||
FirConstKind.Null -> IrConstKind.Null
|
||||
FirConstKind.Boolean -> IrConstKind.Boolean
|
||||
FirConstKind.Char -> IrConstKind.Char
|
||||
private fun ConstantValueKind<*>.toIrConstKind(): IrConstKind<*> = when (this) {
|
||||
ConstantValueKind.Null -> IrConstKind.Null
|
||||
ConstantValueKind.Boolean -> IrConstKind.Boolean
|
||||
ConstantValueKind.Char -> IrConstKind.Char
|
||||
|
||||
FirConstKind.Byte -> IrConstKind.Byte
|
||||
FirConstKind.Short -> IrConstKind.Short
|
||||
FirConstKind.Int -> IrConstKind.Int
|
||||
FirConstKind.Long -> IrConstKind.Long
|
||||
ConstantValueKind.Byte -> IrConstKind.Byte
|
||||
ConstantValueKind.Short -> IrConstKind.Short
|
||||
ConstantValueKind.Int -> IrConstKind.Int
|
||||
ConstantValueKind.Long -> IrConstKind.Long
|
||||
|
||||
FirConstKind.UnsignedByte -> IrConstKind.Byte
|
||||
FirConstKind.UnsignedShort -> IrConstKind.Short
|
||||
FirConstKind.UnsignedInt -> IrConstKind.Int
|
||||
FirConstKind.UnsignedLong -> IrConstKind.Long
|
||||
ConstantValueKind.UnsignedByte -> IrConstKind.Byte
|
||||
ConstantValueKind.UnsignedShort -> IrConstKind.Short
|
||||
ConstantValueKind.UnsignedInt -> IrConstKind.Int
|
||||
ConstantValueKind.UnsignedLong -> IrConstKind.Long
|
||||
|
||||
FirConstKind.String -> IrConstKind.String
|
||||
FirConstKind.Float -> IrConstKind.Float
|
||||
FirConstKind.Double -> IrConstKind.Double
|
||||
FirConstKind.IntegerLiteral, FirConstKind.UnsignedIntegerLiteral -> throw IllegalArgumentException()
|
||||
ConstantValueKind.String -> IrConstKind.String
|
||||
ConstantValueKind.Float -> IrConstKind.Float
|
||||
ConstantValueKind.Double -> IrConstKind.Double
|
||||
ConstantValueKind.IntegerLiteral, ConstantValueKind.UnsignedIntegerLiteral -> throw IllegalArgumentException()
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-2
@@ -253,7 +253,7 @@ class Fir2IrDeclarationStorage(
|
||||
|
||||
private fun <T : IrFunction> T.declareDefaultSetterParameter(type: IrType): T {
|
||||
valueParameters = listOf(
|
||||
createDefaultSetterParameter(startOffset, endOffset, origin, type, parent = this)
|
||||
createDefaultSetterParameter(startOffset, endOffset, type, parent = this)
|
||||
)
|
||||
return this
|
||||
}
|
||||
@@ -261,7 +261,6 @@ class Fir2IrDeclarationStorage(
|
||||
internal fun createDefaultSetterParameter(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
type: IrType,
|
||||
parent: IrFunction
|
||||
): IrValueParameter {
|
||||
|
||||
+4
-4
@@ -16,7 +16,6 @@ import org.jetbrains.kotlin.fir.render
|
||||
import org.jetbrains.kotlin.fir.resolve.inference.*
|
||||
import org.jetbrains.kotlin.fir.types.ConeClassLikeType
|
||||
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.coneType
|
||||
import org.jetbrains.kotlin.ir.builders.declarations.UNDEFINED_PARAMETER_INDEX
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
@@ -51,8 +50,6 @@ internal class AdapterGenerator(
|
||||
private val conversionScope: Fir2IrConversionScope
|
||||
) : Fir2IrComponents by components {
|
||||
|
||||
private fun FirTypeRef.toIrType(): IrType = with(typeConverter) { toIrType() }
|
||||
|
||||
private fun ConeKotlinType.toIrType(): IrType = with(typeConverter) { toIrType() }
|
||||
|
||||
internal fun needToGenerateAdaptedCallableReference(
|
||||
@@ -85,7 +82,10 @@ internal class AdapterGenerator(
|
||||
*/
|
||||
private fun needCoercionToUnit(type: IrSimpleType, function: IrFunction): Boolean {
|
||||
val expectedReturnType = type.arguments.last().typeOrNull
|
||||
return expectedReturnType?.isUnit() == true && !function.returnType.isUnit()
|
||||
val actualReturnType = function.returnType
|
||||
return expectedReturnType?.isUnit() == true &&
|
||||
// In case of an external function whose return type is a type parameter, e.g., operator fun <T, R> invoke(T): R
|
||||
!actualReturnType.isUnit() && !actualReturnType.isTypeParameter()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+9
-9
@@ -170,7 +170,7 @@ class CallAndReferenceGenerator(
|
||||
return null
|
||||
}
|
||||
|
||||
private fun FirExpression.superQualifierSymbol(callSymbol: IrSymbol?): IrClassSymbol? {
|
||||
private fun FirExpression.superQualifierSymbol(): IrClassSymbol? {
|
||||
if (this !is FirQualifiedAccess) {
|
||||
return null
|
||||
}
|
||||
@@ -220,7 +220,7 @@ class CallAndReferenceGenerator(
|
||||
typeArgumentsCount = symbol.owner.typeParameters.size,
|
||||
valueArgumentsCount = symbol.owner.valueParameters.size,
|
||||
origin = qualifiedAccess.calleeReference.statementOrigin(),
|
||||
superQualifierSymbol = dispatchReceiver.superQualifierSymbol(symbol)
|
||||
superQualifierSymbol = dispatchReceiver.superQualifierSymbol()
|
||||
)
|
||||
}
|
||||
is IrLocalDelegatedPropertySymbol -> {
|
||||
@@ -229,7 +229,7 @@ class CallAndReferenceGenerator(
|
||||
typeArgumentsCount = symbol.owner.getter.typeParameters.size,
|
||||
valueArgumentsCount = 0,
|
||||
origin = IrStatementOrigin.GET_LOCAL_PROPERTY,
|
||||
superQualifierSymbol = dispatchReceiver.superQualifierSymbol(symbol)
|
||||
superQualifierSymbol = dispatchReceiver.superQualifierSymbol()
|
||||
)
|
||||
}
|
||||
is IrPropertySymbol -> {
|
||||
@@ -241,11 +241,11 @@ class CallAndReferenceGenerator(
|
||||
typeArgumentsCount = getter.typeParameters.size,
|
||||
valueArgumentsCount = 0,
|
||||
origin = IrStatementOrigin.GET_PROPERTY,
|
||||
superQualifierSymbol = dispatchReceiver.superQualifierSymbol(symbol)
|
||||
superQualifierSymbol = dispatchReceiver.superQualifierSymbol()
|
||||
)
|
||||
backingField != null -> IrGetFieldImpl(
|
||||
startOffset, endOffset, backingField.symbol, type,
|
||||
superQualifierSymbol = dispatchReceiver.superQualifierSymbol(symbol)
|
||||
superQualifierSymbol = dispatchReceiver.superQualifierSymbol()
|
||||
)
|
||||
else -> IrErrorCallExpressionImpl(
|
||||
startOffset, endOffset, type,
|
||||
@@ -256,7 +256,7 @@ class CallAndReferenceGenerator(
|
||||
is IrFieldSymbol -> IrGetFieldImpl(
|
||||
startOffset, endOffset, symbol, type,
|
||||
origin = IrStatementOrigin.GET_PROPERTY.takeIf { qualifiedAccess.calleeReference !is FirDelegateFieldReference },
|
||||
superQualifierSymbol = dispatchReceiver.superQualifierSymbol(symbol)
|
||||
superQualifierSymbol = dispatchReceiver.superQualifierSymbol()
|
||||
)
|
||||
is IrValueSymbol -> IrGetValueImpl(
|
||||
startOffset, endOffset, type, symbol,
|
||||
@@ -297,7 +297,7 @@ class CallAndReferenceGenerator(
|
||||
typeArgumentsCount = setter.typeParameters.size,
|
||||
valueArgumentsCount = 1,
|
||||
origin = origin,
|
||||
superQualifierSymbol = variableAssignment.dispatchReceiver.superQualifierSymbol(symbol)
|
||||
superQualifierSymbol = variableAssignment.dispatchReceiver.superQualifierSymbol()
|
||||
).apply {
|
||||
putValueArgument(0, assignedValue)
|
||||
}
|
||||
@@ -314,14 +314,14 @@ class CallAndReferenceGenerator(
|
||||
typeArgumentsCount = setter.typeParameters.size,
|
||||
valueArgumentsCount = 1,
|
||||
origin = origin,
|
||||
superQualifierSymbol = variableAssignment.dispatchReceiver.superQualifierSymbol(symbol)
|
||||
superQualifierSymbol = variableAssignment.dispatchReceiver.superQualifierSymbol()
|
||||
).apply {
|
||||
putValueArgument(0, assignedValue)
|
||||
}
|
||||
backingField != null -> IrSetFieldImpl(
|
||||
startOffset, endOffset, backingField.symbol, type,
|
||||
origin = null, // NB: to be consistent with PSI2IR, origin should be null here
|
||||
superQualifierSymbol = variableAssignment.dispatchReceiver.superQualifierSymbol(symbol)
|
||||
superQualifierSymbol = variableAssignment.dispatchReceiver.superQualifierSymbol()
|
||||
).apply {
|
||||
value = assignedValue
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ class Fir2IrLazyPropertyAccessor(
|
||||
declarationStorage.enterScope(this)
|
||||
listOf(
|
||||
declarationStorage.createDefaultSetterParameter(
|
||||
startOffset, endOffset, origin,
|
||||
startOffset, endOffset,
|
||||
(firAccessor?.valueParameters?.firstOrNull()?.returnTypeRef ?: firParentProperty.returnTypeRef).toIrType(
|
||||
typeConverter, conversionTypeContext
|
||||
),
|
||||
@@ -88,4 +88,4 @@ class Fir2IrLazyPropertyAccessor(
|
||||
get() = firParentProperty.containerSource
|
||||
|
||||
private val conversionTypeContext = if (isSetter) ConversionTypeContext.DEFAULT.inSetter() else ConversionTypeContext.DEFAULT
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -710,6 +710,11 @@ public class FirBlackBoxAgainstJavaCodegenTestGenerated extends AbstractFirBlack
|
||||
runTest("compiler/testData/codegen/boxAgainstJava/sam/samConstructorGenericSignature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("smartCastSamConversion.kt")
|
||||
public void testSmartCastSamConversion() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxAgainstJava/sam/smartCastSamConversion.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Generated
-5
@@ -4974,11 +4974,6 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest {
|
||||
runTest("compiler/testData/codegen/bytecodeText/whenEnumOptimization/kt14802.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt15806.kt")
|
||||
public void testKt15806() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/whenEnumOptimization/kt15806.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("manyWhensWithinClass.kt")
|
||||
public void testManyWhensWithinClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/whenEnumOptimization/manyWhensWithinClass.kt");
|
||||
|
||||
+10
@@ -1188,6 +1188,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
|
||||
runTest("compiler/testData/ir/irText/expressions/membersImportedFromObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multipleSmartCasts.kt")
|
||||
public void testMultipleSmartCasts() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/expressions/multipleSmartCasts.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multipleThisReferences.kt")
|
||||
public void testMultipleThisReferences() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/expressions/multipleThisReferences.kt");
|
||||
@@ -1453,6 +1458,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
|
||||
runTest("compiler/testData/ir/irText/expressions/whenReturnUnit.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenSmartCastToEnum.kt")
|
||||
public void testWhenSmartCastToEnum() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/expressions/whenSmartCastToEnum.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenUnusedExpression.kt")
|
||||
public void testWhenUnusedExpression() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/expressions/whenUnusedExpression.kt");
|
||||
|
||||
@@ -71,6 +71,14 @@ class JavaSymbolProvider(
|
||||
override fun getTopLevelCallableSymbolsTo(destination: MutableList<FirCallableSymbol<*>>, packageFqName: FqName, name: Name) {
|
||||
}
|
||||
|
||||
@FirSymbolProviderInternals
|
||||
override fun getTopLevelFunctionSymbolsTo(destination: MutableList<FirNamedFunctionSymbol>, packageFqName: FqName, name: Name) {
|
||||
}
|
||||
|
||||
@FirSymbolProviderInternals
|
||||
override fun getTopLevelPropertySymbolsTo(destination: MutableList<FirPropertySymbol>, packageFqName: FqName, name: Name) {
|
||||
}
|
||||
|
||||
private fun JavaTypeParameter.toFirTypeParameterSymbol(
|
||||
javaTypeParameterStack: JavaTypeParameterStack
|
||||
): Pair<FirTypeParameterSymbol, Boolean> {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user