/* Ċ Ġ* ĠCopyright Ġ 2 0 1 0 - 2 0 1 9 Ġ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 . resolve . calls . components Ċ Ċ import Ġorg . jetbrains . kotlin . builtins . Kotlin Built Ins Ċ import Ġorg . jetbrains . kotlin . config . Language Feature Ċ import Ġorg . jetbrains . kotlin . config . Language Version Settings Ċ import Ġorg . jetbrains . kotlin . resolve . calls . inference . components . Constraint Injector Ċ import Ġorg . jetbrains . kotlin . resolve . calls . inference . components . Empty Subst it utor Ċ import Ġorg . jetbrains . kotlin . resolve . calls . inference . components . New Type Subst it utor Ċ import Ġorg . jetbrains . kotlin . resolve . calls . inference . components . New Type Subst it utor By Constructor Map Ċ import Ġorg . jetbrains . kotlin . resolve . calls . inference . model . New Constraint System Impl Ċ import Ġorg . jetbrains . kotlin . resolve . calls . inference . model . New Type Variable Ċ import Ġorg . jetbrains . kotlin . resolve . calls . inference . model . Type Variable Type Constructor Ċ import Ġorg . jetbrains . kotlin . types .* Ċ import Ġorg . jetbrains . kotlin . types . checker . Classic Type System Context Ċ import Ġorg . jetbrains . kotlin . types . checker . New Capt ured Type Ċ import Ġorg . jetbrains . kotlin . types . checker . New Capt ured Type Constructor Ċ import Ġorg . jetbrains . kotlin . types . model .* Ċ import Ġorg . jetbrains . kotlin . utils . addTo Std lib . cast Ċ Ċ class ĠClass ic Type System Context For CS ( override Ġval Ġbuilt Ins : ĠKotlin Built Ins ) Ġ: ĠType System Inference Extension Context Delegate , ĊĠĠĠ ĠClass ic Type System Context , ĊĠĠĠ ĠBuilt Ins Provider Ġ{ ĊĊĠĠĠ Ġoverride Ġfun ĠType Variable Marker . default Type (): ĠSimple Type Marker Ġ{ ĊĠĠĠĠĠĠĠ Ġrequire ( this Ġis ĠNew Type Variable , Ġthis :: errorMessage ) ĊĠĠĠĠĠĠĠ Ġreturn Ġthis . default Type ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠType Variable Marker . fresh Type Constructor (): ĠType Constructor Marker Ġ{ ĊĠĠĠĠĠĠĠ Ġrequire ( this Ġis ĠNew Type Variable , Ġthis :: errorMessage ) ĊĠĠĠĠĠĠĠ Ġreturn Ġthis . fresh Type Constructor ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġcreate Capt ured Type ( ĊĠĠĠĠĠĠĠ Ġconstructor Projection : ĠType Argument Marker , ĊĠĠĠĠĠĠĠ Ġconstructor Sup ert ypes : ĠList < Kotlin Type Marker >, ĊĠĠĠĠĠĠĠ Ġlower Type : ĠKotlin Type Marker ?, ĊĠĠĠĠĠĠĠ Ġcapture Status : ĠCapture Status ĊĠĠĠ Ġ): ĠCapt ured Type Marker Ġ{ ĊĠĠĠĠĠĠĠ Ġrequire ( lower Type Ġis ĠUn wrapped Type ?, Ġlower Type :: errorMessage ) ĊĠĠĠĠĠĠĠ Ġrequire ( constructor Projection Ġis ĠType Projection Base , Ġconstructor Projection :: errorMessage ) ĊĊĠĠĠĠĠĠĠ Ġ@ Suppress (" UN CHECK ED _ CAST ") ĊĠĠĠĠĠĠĠ Ġval Ġnew Capt ured Type Constructor Ġ= ĠNew Capt ured Type Constructor ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġconstructor Projection , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġconstructor Sup ert ypes Ġas ĠList < Un wrapped Type > ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġreturn ĠNew Capt ured Type ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcapture Status , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnew Capt ured Type Constructor , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlower Type Ġ= Ġlower Type ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġtype Subst it utor ByType Constructor ( map : ĠMap < Type Constructor Marker , ĠKotlin Type Marker >): ĠType Subst it utor Marker Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( map . isEmpty ()) Ġreturn Ġcreate Empty Subst it utor () ĊĠĠĠĠĠĠĠ Ġreturn ĠNew Type Subst it utor By Constructor Map ( map . cast ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġcreate Empty Subst it utor (): ĠType Subst it utor Marker Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠEmpty Subst it utor ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠType Subst it utor Marker . safe Subst itute ( type : ĠKotlin Type Marker ): ĠKotlin Type Marker Ġ{ ĊĠĠĠĠĠĠĠ Ġrequire ( type Ġis ĠUn wrapped Type , Ġtype :: errorMessage ) ĊĠĠĠĠĠĠĠ Ġreturn Ġwhen Ġ( this ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠNew Type Subst it utor Ġ-> Ġsafe Subst itute ( type ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠType Subst it utor Ġ-> Ġsafe Subst itute ( type , ĠVari ance . IN VARIANT ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġelse Ġ-> Ġerror ( this . errorMessage ()) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġcreate Stub Type For Builder Inference ( type Variable : ĠType Variable Marker ): ĠStub Type Marker Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠStub Type For Builder Inference ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtype Variable . fresh Type Constructor () Ġas ĠType Constructor , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtype Variable . default Type (). is Marked Nullable () ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġcreate Stub Type ForType Variables In Sub typing ( type Variable : ĠType Variable Marker ): ĠStub Type Marker Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠStub Type ForType Variables In Sub typing ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtype Variable . fresh Type Constructor () Ġas ĠType Constructor , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtype Variable . default Type (). is Marked Nullable () ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠType Constructor Marker . is Type Variable (): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġthis Ġis ĠType Variable Type Constructor ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠType Variable Type Constructor Marker . is Cont ained In Invariant Or Contr av ari ant Positions (): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġrequire ( this Ġis ĠType Variable Type Constructor ) ĊĠĠĠĠĠĠĠ Ġreturn Ġis Cont ained In Invariant Or Contr av ari ant Positions ĊĠĠĠ Ġ} Ċ } ĊĊĊ Ċ @ Suppress (" NOTH ING _ TO _ INLINE ") Ċ private Ġinline Ġfun ĠAny ?. errorMessage (): ĠString Ġ{ ĊĠĠĠ Ġreturn Ġ" Classic Type System Context For CS Ġcouldn 't Ġhandle : Ġ$ this , Ġ${ this ?. let Ġ{ Ġit :: class Ġ}}" Ċ } Ċ Ċ @ Suppress (" FunctionName ") Ċ fun ĠNew Constraint System Impl ( ĊĠĠĠ Ġconstraint Injector : ĠConstraint Injector , ĊĠĠĠ Ġbuilt Ins : ĠKotlin Built Ins Ċ ): ĠNew Constraint System Impl Ġ{ ĊĠĠĠ Ġreturn ĠNew Constraint System Impl ( constraint Injector , ĠClass ic Type System Context For CS ( built Ins )) Ċ } Ċ