K2: perform IOT approximation in completion properly #KT-58520 Fixed
This commit is contained in:
committed by
Space Team
parent
8bc72cb2e5
commit
9011af1008
+28
-14
@@ -17,25 +17,27 @@ import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind
|
|||||||
import org.jetbrains.kotlin.fir.expressions.*
|
import org.jetbrains.kotlin.fir.expressions.*
|
||||||
import org.jetbrains.kotlin.fir.expressions.impl.FirPropertyAccessExpressionImpl
|
import org.jetbrains.kotlin.fir.expressions.impl.FirPropertyAccessExpressionImpl
|
||||||
import org.jetbrains.kotlin.fir.references.FirNamedReference
|
import org.jetbrains.kotlin.fir.references.FirNamedReference
|
||||||
import org.jetbrains.kotlin.fir.references.builder.buildErrorNamedReference
|
|
||||||
import org.jetbrains.kotlin.fir.references.builder.buildResolvedCallableReference
|
import org.jetbrains.kotlin.fir.references.builder.buildResolvedCallableReference
|
||||||
import org.jetbrains.kotlin.fir.references.builder.buildResolvedErrorReference
|
|
||||||
import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference
|
import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference
|
||||||
import org.jetbrains.kotlin.fir.resolve.*
|
import org.jetbrains.kotlin.fir.resolve.*
|
||||||
import org.jetbrains.kotlin.fir.resolve.calls.Candidate
|
import org.jetbrains.kotlin.fir.resolve.calls.Candidate
|
||||||
import org.jetbrains.kotlin.fir.resolve.calls.FirErrorReferenceWithCandidate
|
import org.jetbrains.kotlin.fir.resolve.calls.FirErrorReferenceWithCandidate
|
||||||
import org.jetbrains.kotlin.fir.resolve.calls.FirNamedReferenceWithCandidate
|
import org.jetbrains.kotlin.fir.resolve.calls.FirNamedReferenceWithCandidate
|
||||||
import org.jetbrains.kotlin.fir.resolve.dfa.FirDataFlowAnalyzer
|
import org.jetbrains.kotlin.fir.resolve.dfa.FirDataFlowAnalyzer
|
||||||
import org.jetbrains.kotlin.fir.resolve.diagnostics.*
|
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeConstraintSystemHasContradiction
|
||||||
|
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeInapplicableCandidateError
|
||||||
|
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConePropertyAsOperator
|
||||||
|
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeTypeParameterInQualifiedAccess
|
||||||
import org.jetbrains.kotlin.fir.resolve.inference.ResolvedLambdaAtom
|
import org.jetbrains.kotlin.fir.resolve.inference.ResolvedLambdaAtom
|
||||||
import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider
|
|
||||||
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
||||||
import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.*
|
import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.*
|
||||||
import org.jetbrains.kotlin.fir.scopes.impl.ConvertibleIntegerOperators.binaryOperatorsWithSignedArgument
|
import org.jetbrains.kotlin.fir.scopes.impl.ConvertibleIntegerOperators.binaryOperatorsWithSignedArgument
|
||||||
import org.jetbrains.kotlin.fir.scopes.impl.isWrappedIntegerOperator
|
import org.jetbrains.kotlin.fir.scopes.impl.isWrappedIntegerOperator
|
||||||
import org.jetbrains.kotlin.fir.scopes.impl.isWrappedIntegerOperatorForUnsignedType
|
import org.jetbrains.kotlin.fir.scopes.impl.isWrappedIntegerOperatorForUnsignedType
|
||||||
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
import org.jetbrains.kotlin.fir.symbols.impl.FirConstructorSymbol
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
|
||||||
import org.jetbrains.kotlin.fir.types.*
|
import org.jetbrains.kotlin.fir.types.*
|
||||||
import org.jetbrains.kotlin.fir.types.builder.buildErrorTypeRef
|
import org.jetbrains.kotlin.fir.types.builder.buildErrorTypeRef
|
||||||
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
||||||
@@ -65,6 +67,18 @@ class FirCallCompletionResultsWriterTransformer(
|
|||||||
private val mode: Mode = Mode.Normal
|
private val mode: Mode = Mode.Normal
|
||||||
) : FirAbstractTreeTransformer<ExpectedArgumentType?>(phase = FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE) {
|
) : FirAbstractTreeTransformer<ExpectedArgumentType?>(phase = FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE) {
|
||||||
|
|
||||||
|
private fun finallySubstituteOrNull(type: ConeKotlinType): ConeKotlinType? {
|
||||||
|
val result = finalSubstitutor.substituteOrNull(type)
|
||||||
|
if (result == null && type is ConeIntegerLiteralType) {
|
||||||
|
return type.approximateIntegerLiteralType()
|
||||||
|
}
|
||||||
|
return result?.approximateIntegerLiteralType()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun finallySubstituteOrSelf(type: ConeKotlinType): ConeKotlinType {
|
||||||
|
return finallySubstituteOrNull(type) ?: type
|
||||||
|
}
|
||||||
|
|
||||||
private val arrayOfCallTransformer = FirArrayOfCallTransformer()
|
private val arrayOfCallTransformer = FirArrayOfCallTransformer()
|
||||||
private var enableArrayOfCallTransformation = false
|
private var enableArrayOfCallTransformation = false
|
||||||
|
|
||||||
@@ -309,7 +323,7 @@ class FirCallCompletionResultsWriterTransformer(
|
|||||||
candidate: Candidate,
|
candidate: Candidate,
|
||||||
): FirResolvedTypeRef {
|
): FirResolvedTypeRef {
|
||||||
val initialType = candidate.substitutor.substituteOrSelf(type)
|
val initialType = candidate.substitutor.substituteOrSelf(type)
|
||||||
val substitutedType = finalSubstitutor.substituteOrNull(initialType)
|
val substitutedType = finallySubstituteOrNull(initialType)
|
||||||
val finalType = typeApproximator.approximateToSuperType(
|
val finalType = typeApproximator.approximateToSuperType(
|
||||||
type = substitutedType ?: initialType, TypeApproximatorConfiguration.FinalApproximationAfterResolutionAndInference,
|
type = substitutedType ?: initialType, TypeApproximatorConfiguration.FinalApproximationAfterResolutionAndInference,
|
||||||
) ?: substitutedType
|
) ?: substitutedType
|
||||||
@@ -360,7 +374,7 @@ class FirCallCompletionResultsWriterTransformer(
|
|||||||
val typeRef = callableReferenceAccess.typeRef as FirResolvedTypeRef
|
val typeRef = callableReferenceAccess.typeRef as FirResolvedTypeRef
|
||||||
|
|
||||||
val initialType = calleeReference.candidate.substitutor.substituteOrSelf(typeRef.type)
|
val initialType = calleeReference.candidate.substitutor.substituteOrSelf(typeRef.type)
|
||||||
val finalType = finalSubstitutor.substituteOrSelf(initialType)
|
val finalType = finallySubstituteOrSelf(initialType)
|
||||||
|
|
||||||
val resultType = typeRef.withReplacedConeType(finalType)
|
val resultType = typeRef.withReplacedConeType(finalType)
|
||||||
callableReferenceAccess.replaceTypeRef(resultType)
|
callableReferenceAccess.replaceTypeRef(resultType)
|
||||||
@@ -399,7 +413,7 @@ class FirCallCompletionResultsWriterTransformer(
|
|||||||
data: Any?
|
data: Any?
|
||||||
): FirStatement {
|
): FirStatement {
|
||||||
val originalType = qualifiedAccessExpression.typeRef.coneType
|
val originalType = qualifiedAccessExpression.typeRef.coneType
|
||||||
val substitutedReceiverType = finalSubstitutor.substituteOrNull(originalType) ?: return qualifiedAccessExpression
|
val substitutedReceiverType = finallySubstituteOrNull(originalType) ?: return qualifiedAccessExpression
|
||||||
val resolvedTypeRef = qualifiedAccessExpression.typeRef.resolvedTypeFromPrototype(substitutedReceiverType)
|
val resolvedTypeRef = qualifiedAccessExpression.typeRef.resolvedTypeFromPrototype(substitutedReceiverType)
|
||||||
qualifiedAccessExpression.replaceTypeRef(resolvedTypeRef)
|
qualifiedAccessExpression.replaceTypeRef(resolvedTypeRef)
|
||||||
session.lookupTracker?.recordTypeResolveAsLookup(resolvedTypeRef, qualifiedAccessExpression.source, context.file.source)
|
session.lookupTracker?.recordTypeResolveAsLookup(resolvedTypeRef, qualifiedAccessExpression.source, context.file.source)
|
||||||
@@ -413,11 +427,11 @@ class FirCallCompletionResultsWriterTransformer(
|
|||||||
|
|
||||||
private fun FirTypeRef.substitute(candidate: Candidate): ConeKotlinType =
|
private fun FirTypeRef.substitute(candidate: Candidate): ConeKotlinType =
|
||||||
coneType.let { candidate.substitutor.substituteOrSelf(it) }
|
coneType.let { candidate.substitutor.substituteOrSelf(it) }
|
||||||
.let { finalSubstitutor.substituteOrSelf(it) }
|
.let { finallySubstituteOrSelf(it) }
|
||||||
|
|
||||||
private fun Candidate.createArgumentsMapping(): ExpectedArgumentType? {
|
private fun Candidate.createArgumentsMapping(): ExpectedArgumentType? {
|
||||||
val lambdasReturnType = postponedAtoms.filterIsInstance<ResolvedLambdaAtom>().associate {
|
val lambdasReturnType = postponedAtoms.filterIsInstance<ResolvedLambdaAtom>().associate {
|
||||||
Pair(it.atom, finalSubstitutor.substituteOrSelf(substitutor.substituteOrSelf(it.returnType)).approximateIntegerLiteralType())
|
Pair(it.atom, finallySubstituteOrSelf(substitutor.substituteOrSelf(it.returnType)))
|
||||||
}
|
}
|
||||||
|
|
||||||
val isIntegerOperator = symbol.isWrappedIntegerOperator()
|
val isIntegerOperator = symbol.isWrappedIntegerOperator()
|
||||||
@@ -514,7 +528,7 @@ class FirCallCompletionResultsWriterTransformer(
|
|||||||
return declaration.typeParameters.map {
|
return declaration.typeParameters.map {
|
||||||
val typeParameter = ConeTypeParameterTypeImpl(it.symbol.toLookupTag(), false)
|
val typeParameter = ConeTypeParameterTypeImpl(it.symbol.toLookupTag(), false)
|
||||||
val substitution = candidate.substitutor.substituteOrSelf(typeParameter)
|
val substitution = candidate.substitutor.substituteOrSelf(typeParameter)
|
||||||
finalSubstitutor.substituteOrSelf(substitution).let { substitutedType ->
|
finallySubstituteOrSelf(substitution).let { substitutedType ->
|
||||||
typeApproximator.approximateToSuperType(
|
typeApproximator.approximateToSuperType(
|
||||||
substitutedType, TypeApproximatorConfiguration.TypeArgumentApproximation,
|
substitutedType, TypeApproximatorConfiguration.TypeArgumentApproximation,
|
||||||
) ?: substitutedType
|
) ?: substitutedType
|
||||||
@@ -566,14 +580,14 @@ class FirCallCompletionResultsWriterTransformer(
|
|||||||
|
|
||||||
val receiverParameter = anonymousFunction.receiverParameter
|
val receiverParameter = anonymousFunction.receiverParameter
|
||||||
val initialReceiverType = receiverParameter?.typeRef?.coneTypeSafe<ConeKotlinType>()
|
val initialReceiverType = receiverParameter?.typeRef?.coneTypeSafe<ConeKotlinType>()
|
||||||
val resultReceiverType = initialReceiverType?.let { finalSubstitutor.substituteOrNull(it) }
|
val resultReceiverType = initialReceiverType?.let { finallySubstituteOrNull(it) }
|
||||||
if (resultReceiverType != null) {
|
if (resultReceiverType != null) {
|
||||||
receiverParameter.replaceTypeRef(receiverParameter.typeRef.resolvedTypeFromPrototype(resultReceiverType))
|
receiverParameter.replaceTypeRef(receiverParameter.typeRef.resolvedTypeFromPrototype(resultReceiverType))
|
||||||
needUpdateLambdaType = true
|
needUpdateLambdaType = true
|
||||||
}
|
}
|
||||||
|
|
||||||
val initialReturnType = anonymousFunction.returnTypeRef.coneTypeSafe<ConeKotlinType>()
|
val initialReturnType = anonymousFunction.returnTypeRef.coneTypeSafe<ConeKotlinType>()
|
||||||
val expectedReturnType = initialReturnType?.let { finalSubstitutor.substituteOrSelf(it) }
|
val expectedReturnType = initialReturnType?.let { finallySubstituteOrSelf(it) }
|
||||||
?: expectedType?.returnType(session) as? ConeClassLikeType
|
?: expectedType?.returnType(session) as? ConeClassLikeType
|
||||||
?: (data as? ExpectedArgumentType.ArgumentsMap)?.lambdasReturnTypes?.get(anonymousFunction)
|
?: (data as? ExpectedArgumentType.ArgumentsMap)?.lambdasReturnTypes?.get(anonymousFunction)
|
||||||
|
|
||||||
@@ -649,7 +663,7 @@ class FirCallCompletionResultsWriterTransformer(
|
|||||||
override fun transformBlock(block: FirBlock, data: ExpectedArgumentType?): FirStatement {
|
override fun transformBlock(block: FirBlock, data: ExpectedArgumentType?): FirStatement {
|
||||||
val initialType = block.resultType.coneTypeSafe<ConeKotlinType>()
|
val initialType = block.resultType.coneTypeSafe<ConeKotlinType>()
|
||||||
if (initialType != null) {
|
if (initialType != null) {
|
||||||
val finalType = finalSubstitutor.substituteOrNull(initialType)
|
val finalType = finallySubstituteOrNull(initialType)
|
||||||
var resultType = block.resultType.withReplacedConeType(finalType)
|
var resultType = block.resultType.withReplacedConeType(finalType)
|
||||||
resultType.coneTypeSafe<ConeIntegerLiteralType>()?.let {
|
resultType.coneTypeSafe<ConeIntegerLiteralType>()?.let {
|
||||||
resultType = resultType.resolvedTypeFromPrototype(it.getApproximatedType(data?.getExpectedType(block)?.fullyExpandedType(session)))
|
resultType = resultType.resolvedTypeFromPrototype(it.getApproximatedType(data?.getExpectedType(block)?.fullyExpandedType(session)))
|
||||||
|
|||||||
@@ -0,0 +1,148 @@
|
|||||||
|
FILE fqName:<root> fileName:/timesInBuilder.kt
|
||||||
|
FUN name:test visibility:private modality:FINAL <> (x:kotlin.Long) returnType:kotlin.Unit
|
||||||
|
VALUE_PARAMETER name:x index:0 type:kotlin.Long
|
||||||
|
BLOCK_BODY
|
||||||
|
RETURN type=kotlin.Nothing from='private final fun test (x: kotlin.Long): kotlin.Unit declared in <root>'
|
||||||
|
CALL 'private final fun countIssues (restrictionsBuilder: @[ExtensionFunctionType] kotlin.Function1<<root>.ArgumentsBuilder, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
||||||
|
restrictionsBuilder: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<<root>.ArgumentsBuilder, kotlin.Unit> origin=LAMBDA
|
||||||
|
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.ArgumentsBuilder) returnType:kotlin.Unit
|
||||||
|
$receiver: VALUE_PARAMETER name:$this$countIssues type:<root>.ArgumentsBuilder
|
||||||
|
BLOCK_BODY
|
||||||
|
CALL 'public final fun unaryPlus (): kotlin.Unit [operator] declared in <root>.ArgumentsBuilder' type=kotlin.Unit origin=null
|
||||||
|
$this: GET_VAR '$this$countIssues: <root>.ArgumentsBuilder declared in <root>.test.<anonymous>' type=<root>.ArgumentsBuilder origin=null
|
||||||
|
$receiver: CALL 'public final fun lessEq <T> (t: T of <root>.lessEq): <root>.Expression [infix] declared in <root>' type=<root>.Expression origin=null
|
||||||
|
<T>: kotlin.Int
|
||||||
|
$receiver: CALL 'public final fun <get-spentTime> (): <root>.Column declared in <root>' type=<root>.Column origin=GET_PROPERTY
|
||||||
|
t: CONST Int type=kotlin.Int value=120
|
||||||
|
CALL 'public final fun unaryPlus (): kotlin.Unit [operator] declared in <root>.ArgumentsBuilder' type=kotlin.Unit origin=null
|
||||||
|
$this: GET_VAR '$this$countIssues: <root>.ArgumentsBuilder declared in <root>.test.<anonymous>' type=<root>.ArgumentsBuilder origin=null
|
||||||
|
$receiver: CALL 'public final fun lessEq <T> (t: T of <root>.lessEq): <root>.Expression [infix] declared in <root>' type=<root>.Expression origin=null
|
||||||
|
<T>: kotlin.Int
|
||||||
|
$receiver: CALL 'public final fun <get-spentTime> (): <root>.Column declared in <root>' type=<root>.Column origin=GET_PROPERTY
|
||||||
|
t: CALL 'public final fun id <I> (arg: I of <root>.id): I of <root>.id declared in <root>' type=kotlin.Int origin=null
|
||||||
|
<I>: kotlin.Int
|
||||||
|
arg: CONST Int type=kotlin.Int value=120
|
||||||
|
CALL 'public final fun unaryPlus (): kotlin.Unit [operator] declared in <root>.ArgumentsBuilder' type=kotlin.Unit origin=null
|
||||||
|
$this: GET_VAR '$this$countIssues: <root>.ArgumentsBuilder declared in <root>.test.<anonymous>' type=<root>.ArgumentsBuilder origin=null
|
||||||
|
$receiver: CALL 'public final fun select <T> (t: T of <root>.select, r: T of <root>.select): <root>.Expression declared in <root>' type=<root>.Expression origin=null
|
||||||
|
<T>: kotlin.Long
|
||||||
|
$receiver: CALL 'public final fun <get-spentTime> (): <root>.Column declared in <root>' type=<root>.Column origin=GET_PROPERTY
|
||||||
|
t: CONST Long type=kotlin.Long value=120
|
||||||
|
r: GET_VAR 'x: kotlin.Long declared in <root>.test' type=kotlin.Long origin=null
|
||||||
|
PROPERTY name:spentTime visibility:public modality:FINAL [val]
|
||||||
|
FIELD PROPERTY_BACKING_FIELD name:spentTime type:<root>.Column visibility:private [final,static]
|
||||||
|
EXPRESSION_BODY
|
||||||
|
CALL 'public final fun integer (name: kotlin.String): <root>.Column declared in <root>' type=<root>.Column origin=null
|
||||||
|
name: CONST String type=kotlin.String value="spentTime"
|
||||||
|
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-spentTime> visibility:public modality:FINAL <> () returnType:<root>.Column
|
||||||
|
correspondingProperty: PROPERTY name:spentTime visibility:public modality:FINAL [val]
|
||||||
|
BLOCK_BODY
|
||||||
|
RETURN type=kotlin.Nothing from='public final fun <get-spentTime> (): <root>.Column declared in <root>'
|
||||||
|
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:spentTime type:<root>.Column visibility:private [final,static]' type=<root>.Column origin=null
|
||||||
|
FUN name:integer visibility:public modality:FINAL <> (name:kotlin.String) returnType:<root>.Column
|
||||||
|
VALUE_PARAMETER name:name index:0 type:kotlin.String
|
||||||
|
BLOCK_BODY
|
||||||
|
RETURN type=kotlin.Nothing from='public final fun integer (name: kotlin.String): <root>.Column declared in <root>'
|
||||||
|
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.Column' type=<root>.Column origin=null
|
||||||
|
FUN name:id visibility:public modality:FINAL <I> (arg:I of <root>.id) returnType:I of <root>.id
|
||||||
|
TYPE_PARAMETER name:I index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||||
|
VALUE_PARAMETER name:arg index:0 type:I of <root>.id
|
||||||
|
BLOCK_BODY
|
||||||
|
RETURN type=kotlin.Nothing from='public final fun id <I> (arg: I of <root>.id): I of <root>.id declared in <root>'
|
||||||
|
GET_VAR 'arg: I of <root>.id declared in <root>.id' type=I of <root>.id origin=null
|
||||||
|
FUN name:lessEq visibility:public modality:FINAL <T> ($receiver:<root>.Column, t:T of <root>.lessEq) returnType:<root>.Expression [infix]
|
||||||
|
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Comparable<T of <root>.lessEq>] reified:false
|
||||||
|
$receiver: VALUE_PARAMETER name:<this> type:<root>.Column
|
||||||
|
VALUE_PARAMETER name:t index:0 type:T of <root>.lessEq
|
||||||
|
BLOCK_BODY
|
||||||
|
RETURN type=kotlin.Nothing from='public final fun lessEq <T> (t: T of <root>.lessEq): <root>.Expression [infix] declared in <root>'
|
||||||
|
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.Expression' type=<root>.Expression origin=null
|
||||||
|
FUN name:select visibility:public modality:FINAL <T> ($receiver:<root>.Column, t:T of <root>.select, r:T of <root>.select) returnType:<root>.Expression
|
||||||
|
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Comparable<T of <root>.select>] reified:false
|
||||||
|
$receiver: VALUE_PARAMETER name:<this> type:<root>.Column
|
||||||
|
VALUE_PARAMETER name:t index:0 type:T of <root>.select
|
||||||
|
VALUE_PARAMETER name:r index:1 type:T of <root>.select
|
||||||
|
BLOCK_BODY
|
||||||
|
RETURN type=kotlin.Nothing from='public final fun select <T> (t: T of <root>.select, r: T of <root>.select): <root>.Expression declared in <root>'
|
||||||
|
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.Expression' type=<root>.Expression origin=null
|
||||||
|
CLASS CLASS name:Expression modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||||
|
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Expression
|
||||||
|
CONSTRUCTOR visibility:public <> () returnType:<root>.Expression [primary]
|
||||||
|
BLOCK_BODY
|
||||||
|
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||||
|
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Expression modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||||
|
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||||
|
overridden:
|
||||||
|
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||||
|
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||||
|
overridden:
|
||||||
|
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||||
|
overridden:
|
||||||
|
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
CLASS CLASS name:Column modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||||
|
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Column
|
||||||
|
CONSTRUCTOR visibility:public <> () returnType:<root>.Column [primary]
|
||||||
|
BLOCK_BODY
|
||||||
|
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||||
|
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Column modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||||
|
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||||
|
overridden:
|
||||||
|
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||||
|
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||||
|
overridden:
|
||||||
|
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||||
|
overridden:
|
||||||
|
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
CLASS CLASS name:ArgumentsBuilder modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||||
|
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.ArgumentsBuilder
|
||||||
|
CONSTRUCTOR visibility:public <> () returnType:<root>.ArgumentsBuilder [primary]
|
||||||
|
BLOCK_BODY
|
||||||
|
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||||
|
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:ArgumentsBuilder modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||||
|
PROPERTY name:arguments visibility:public modality:FINAL [val]
|
||||||
|
FIELD PROPERTY_BACKING_FIELD name:arguments type:kotlin.collections.MutableList<<root>.Expression> visibility:private [final]
|
||||||
|
EXPRESSION_BODY
|
||||||
|
CALL 'public final fun mutableListOf <T> (): kotlin.collections.MutableList<T of kotlin.collections.CollectionsKt.mutableListOf> [inline] declared in kotlin.collections.CollectionsKt' type=kotlin.collections.MutableList<<root>.Expression> origin=null
|
||||||
|
<T>: <root>.Expression
|
||||||
|
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-arguments> visibility:public modality:FINAL <> ($this:<root>.ArgumentsBuilder) returnType:kotlin.collections.MutableList<<root>.Expression>
|
||||||
|
correspondingProperty: PROPERTY name:arguments visibility:public modality:FINAL [val]
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:<root>.ArgumentsBuilder
|
||||||
|
BLOCK_BODY
|
||||||
|
RETURN type=kotlin.Nothing from='public final fun <get-arguments> (): kotlin.collections.MutableList<<root>.Expression> declared in <root>.ArgumentsBuilder'
|
||||||
|
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:arguments type:kotlin.collections.MutableList<<root>.Expression> visibility:private [final]' type=kotlin.collections.MutableList<<root>.Expression> origin=null
|
||||||
|
receiver: GET_VAR '<this>: <root>.ArgumentsBuilder declared in <root>.ArgumentsBuilder.<get-arguments>' type=<root>.ArgumentsBuilder origin=null
|
||||||
|
FUN name:unaryPlus visibility:public modality:FINAL <> ($this:<root>.ArgumentsBuilder, $receiver:<root>.Expression) returnType:kotlin.Unit [operator]
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:<root>.ArgumentsBuilder
|
||||||
|
$receiver: VALUE_PARAMETER name:<this> type:<root>.Expression
|
||||||
|
BLOCK_BODY
|
||||||
|
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
|
CALL 'public abstract fun add (element: E of kotlin.collections.MutableList): kotlin.Boolean declared in kotlin.collections.MutableList' type=kotlin.Boolean origin=null
|
||||||
|
$this: CALL 'public final fun <get-arguments> (): kotlin.collections.MutableList<<root>.Expression> declared in <root>.ArgumentsBuilder' type=kotlin.collections.MutableList<<root>.Expression> origin=GET_PROPERTY
|
||||||
|
$this: GET_VAR '<this>: <root>.ArgumentsBuilder declared in <root>.ArgumentsBuilder.unaryPlus' type=<root>.ArgumentsBuilder origin=null
|
||||||
|
element: GET_VAR '<this>: <root>.Expression declared in <root>.ArgumentsBuilder.unaryPlus' type=<root>.Expression origin=null
|
||||||
|
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||||
|
overridden:
|
||||||
|
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||||
|
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||||
|
overridden:
|
||||||
|
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||||
|
overridden:
|
||||||
|
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
FUN name:countIssues visibility:private modality:FINAL <> (restrictionsBuilder:@[ExtensionFunctionType] kotlin.Function1<<root>.ArgumentsBuilder, kotlin.Unit>) returnType:kotlin.Unit
|
||||||
|
VALUE_PARAMETER name:restrictionsBuilder index:0 type:@[ExtensionFunctionType] kotlin.Function1<<root>.ArgumentsBuilder, kotlin.Unit>
|
||||||
|
BLOCK_BODY
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
private fun test(x: Long) {
|
||||||
|
return countIssues(restrictionsBuilder = local fun ArgumentsBuilder.<anonymous>() {
|
||||||
|
($this$countIssues, <get-spentTime>().lessEq<Int>(t = 120)).unaryPlus()
|
||||||
|
($this$countIssues, <get-spentTime>().lessEq<Int>(t = id<Int>(arg = 120))).unaryPlus()
|
||||||
|
($this$countIssues, <get-spentTime>().select<Long>(t = 120L, r = x)).unaryPlus()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
val spentTime: Column
|
||||||
|
field = integer(name = "spentTime")
|
||||||
|
get
|
||||||
|
|
||||||
|
fun integer(name: String): Column {
|
||||||
|
return Column()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <I : Any?> id(arg: I): I {
|
||||||
|
return arg
|
||||||
|
}
|
||||||
|
|
||||||
|
infix fun <T : Comparable<T>> Column.lessEq(t: T): Expression {
|
||||||
|
return Expression()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <T : Comparable<T>> Column.select(t: T, r: T): Expression {
|
||||||
|
return Expression()
|
||||||
|
}
|
||||||
|
|
||||||
|
class Expression {
|
||||||
|
constructor() /* primary */ {
|
||||||
|
super/*Any*/()
|
||||||
|
/* <init>() */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class Column {
|
||||||
|
constructor() /* primary */ {
|
||||||
|
super/*Any*/()
|
||||||
|
/* <init>() */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class ArgumentsBuilder {
|
||||||
|
constructor() /* primary */ {
|
||||||
|
super/*Any*/()
|
||||||
|
/* <init>() */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
val arguments: MutableList<Expression>
|
||||||
|
field = mutableListOf<Expression>()
|
||||||
|
get
|
||||||
|
|
||||||
|
operator fun Expression.unaryPlus() {
|
||||||
|
<this>.<get-arguments>().add(element = <this>) /*~> Unit */
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun countIssues(restrictionsBuilder: @ExtensionFunctionType Function1<ArgumentsBuilder, Unit>) {
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user