Commit Graph

501 Commits

Author SHA1 Message Date
Steven Schäfer 26aeddf6d9 Remove broken KotlinType.toIrType function
The KotlinType.toIrType function sometimes produces unbound symbols
and was only used in IrIntrinsicFunction and SharedVariablesManager.

This change removes the broken function and changes SharedVariableManager
to use IrType consistently and IrIntrinsicFunction to use KotlinType
consistently.
2019-04-09 13:46:02 +02:00
Alexander Udalov dd2c7aff6e Implement IrType.equals/hashCode via isEqualTo/toHashCode 2019-04-08 13:06:01 +03:00
Alexander Udalov 8cce5dc8de Fix missing return for checkViaDescriptors in FqNameEqualityChecker 2019-04-08 13:06:01 +03:00
Mikhail Glukhikh 881073b1c9 Add basic FIR -> IR converter with a set of text tests
Tests duplicate IrTextTestCaseGenerated
#KT-24065 Fixed
2019-04-05 16:18:58 +03:00
Anton Bannykh 42f576f033 IR: move serialization to serialization.common 2019-04-05 12:30:20 +03:00
Vasily Levchenko 826f55ecb4 Merge pull request #2240 from JetBrains/rr/minamoto/ir-IrFunctionInlineBodyImpl
[IR] introduced additional field 'inlineFunctionSymbol' to IrReturnableBlock
2019-04-05 11:49:08 +03:00
Vasily Levchenko 1ebf7faedc [IR][refactoring] g/c IrReturnableBlock[Impl]
- drop calculatable from 'inlineFunctionSymbol' fields: 'sourceFileSymbol' and 'sourceFileName' and
replace then with extension values

- drop unused constructors.
2019-04-05 11:47:45 +03:00
Vasily Levchenko 6f9feacf6e [IR] introduced additional field 'inlineFunctionSymbol' to IrReturnableBlock
This change let backend calculate and bind right function to the code block on generation debug information
e.g. for Kotlin/Native backend this let codegnerator to produce DILocation(..., inlinedAt:..) with correct value
for inlinedAt parameter, thus signifiacntly improve behaviour of debugger.
2019-04-04 16:14:34 +03:00
Mark Punzalan 301ac90770 Remove "bound" and "closed" properties from HeaderInfo and
ForLoopHeader, instead assuming that all ranges are closed and that the
"last" property is already property calculated.

This means the HeaderInfo.last for arrays, "indices" and "until"
progressions are decremented from the bound. This simplifies the loop
construction and moves the work to the handlers. This will also simplify
the handling of "reversed()" in the future since we don't need to
consider the case where the lower bound is open.
2019-04-04 09:07:19 +02:00
Mark Punzalan 8e1be5424f Handle for (i in a until Int.MIN_VALUE) corner case by adding
an additional "not empty" condition produced by the UntilHandler.
2019-04-04 09:07:19 +02:00
Mark Punzalan 7b153b2b68 Move building of "not empty" condition (used to check if loop is empty)
from ForLoopsLowering into ForLoopHeader, reducing the building logic in
ForLoopsLowering.
2019-04-04 09:07:19 +02:00
Simon Ogorodnik 3998e842f1 Abstract NewInference & related from KotlinType
Cleanup TypeConstructors & KotlinTypes in VariableFixationFinder
Cleanup TypeConstructors & KotlinTypes in TypeVariableDirectionCalculator
Cleanup KotlinTypes in TypeCheckerContext for ConstraintSystem
Cleanup KotlinTypes in NewCommonSuperTypeCalculator
Cleanup KotlinTypes in TypeApproximator
Cleanup type substitution
Cleanup NewTypeVariable
Cleanup StubType
Cleanup TypeCheckerContext creation, extract common supertype context
Provide TypeSystemInferenceExtensionContext via dependency injection
2019-04-01 22:08:04 +03:00
Dmitry Petrov 2c9ed73ba8 IR: create stubs for constructor type parameters
Java constructors can have type parameters of their own:
  public class J<X extends Number> {
    public <Y extends CharSequence> J() {}
  }

When such constructors are called from Kotlin, type parameters for
constructor follow type parameters for class:
  fun test() = J<Int, String>() // <X=Int, Y=String>

Descriptor-based representation uses the same type parameters ordering.

Also, use 'withScope' in IrLazyFunction type parameters creation.
2019-03-29 16:00:56 +03:00
Dmitry Petrov 8be7f7f1f7 IR: Make sure that symbols refer to original descriptors only
If a descriptor is a WrappedDeclarationDescriptor, it SHOULD NOT be
substituted.
2019-03-29 16:00:56 +03:00
Alexander Udalov b32241c967 JVM IR: build all needed stdlib symbols in JvmSymbols manually
This removes the mandatory dependency of all JVM IR tests on
kotlin-stdlib (ConfigurationKind.ALL in all IR test cases) and speeds up
tests which don't need kotiln-stdlib by about 20%. Another advantage of
this method is that all required dependencies are listed in one file,
are easy to grasp, and changes to the related code generation can be
done independently of the corresponding changes in the actual library,
which may help in bootstrapping the compiler
2019-03-29 12:07:11 +01:00
Igor Chevdar 3838a2f648 [IR] Copied functions from IrGenerator to IrBuilder
With that the number of UNDEFINED_OFFSET should be greater reduced
2019-03-29 12:47:34 +03:00
Alexander Udalov 4cb5a4fb6d Fix misc typos in IR backends 2019-03-28 14:26:09 +01:00
Alexander Udalov 1ee4313803 Minor, introduce IrType.classOrNull 2019-03-28 14:26:09 +01:00
Alexander Udalov dada35d785 Remove obsolete and unused descriptors and utils 2019-03-28 14:26:09 +01:00
Anton Bannykh b3f1908026 JS_IR: remove stub generator from IrBuiltins 2019-03-26 17:38:44 +03:00
Anton Bannykh ed440fc060 JS IR: remove obsolete hack from SymbolTable 2019-03-26 17:38:43 +03:00
Anton Bannykh 530804d072 JS_IR: eager IrBuiltins 2019-03-26 17:38:43 +03:00
Steven Schäfer 29b7da7c49 Implement support for KClass fields in annotation classes. 2019-03-26 11:54:16 +01:00
Anton Bannykh a382956c19 IR: use the correct descriptor for the booleanNotSymbol creation
NOTE corresponding function now has a dispatch receiver instead of a
single argument
2019-03-25 17:49:15 +03:00
Dmitry Petrov d4525e19dd IR: get rid of descriptors in local delegated properties rendering 2019-03-25 11:50:14 +03:00
Dmitry Petrov 12e9943f8f IR: IrCallableReference now implements IrDeclarationReference 2019-03-25 11:50:14 +03:00
Dmitry Petrov 6ca61cf347 IR: symbol for IrLocalDelegatedProperty 2019-03-25 11:50:14 +03:00
Georgy Bronnikov 0a2450bcd5 Remove duplicate definitions 2019-03-23 19:04:36 +03:00
Georgy Bronnikov 451cda79de Rewrite AnnotationCodegen for IR, removing descriptors 2019-03-23 19:04:36 +03:00
Roman Artemev 538512fa2a [JS IR BE] Fix unbound symbols after deserialization
* restore broken psi2ir invariant
2019-03-21 16:26:51 +03:00
Dmitry Petrov a5c95275f0 IR: get rid of descriptors in DumpIrTree 2019-03-21 11:23:51 +03:00
Dmitry Petrov 9a82f926a1 IR: descriptor-less rendering of IR elements (work in progress) 2019-03-21 11:23:51 +03:00
Dmitry Petrov cd138bc022 IR: IrSymbolVisitor 2019-03-21 11:23:51 +03:00
Dmitry Petrov 110a15d395 IR: drop IrFile.fileAnnotations (it already has annotations anyway) 2019-03-21 11:23:51 +03:00
Dmitry Petrov b42aa39033 IR: drop IrTypeAlias 2019-03-21 11:23:51 +03:00
Dmitry Petrov e49eae528c IR: don't use descriptors in rendering (work in progress)
There's some descriptor-based code remaining. Need some more work on IR.
2019-03-21 11:23:51 +03:00
Roman Artemev 698594b14d [IR] Fix classifier equality for Local classes 2019-03-20 23:45:03 +03:00
Ting-Yuan Huang f352a4dcd4 IrBuiltIns: factoring out operator names
so that they can be used in other contexts.
2019-03-20 21:02:55 +01:00
Dmitry Petrov 9f48695dde psi2ir: no unbound field symbols in delegated property references
#KT-30323 Fixed
2019-03-20 11:57:57 +03:00
Dmitry Petrov 15918fc475 IR: deprecations 2019-03-20 11:57:57 +03:00
Dmitry Petrov 04fad012a0 IR: IrPropertySymbol introduced, some code cleaned up
#KT-30304
2019-03-20 11:57:57 +03:00
Roman Artemev 2ed29d8869 [IR BE] Use pure IrType instead of KotlinType
* clean up code
2019-03-19 20:09:07 +03:00
pyos 330c4648cb Implement property references in JVM_IR 2019-03-19 12:00:29 +01:00
Alexander Udalov c730de13df Minor, add missing copyright to compiler modules 2019-03-15 19:27:46 +01:00
Alexander Udalov 9ca7719d1f Minor, inline obsolete and deprecated createFunctionSymbol
Also undeprecate 'createSymbolForScopeOwner' and make it private
2019-03-15 19:07:16 +01:00
Alexander Udalov 0c8e58936c Remove DeepCopyIrTree and most "Creates unbound symbol" deprecated members 2019-03-15 19:05:19 +01:00
Roman Artemev 238f1b2b06 [IR] * Implement isSubtypeOfClass and commonSuperclass based on pure Ir
* Implement type strict equality check
     * Move type checkers into Ir
     * Implement strict Fqn-based classifier equality checker
2019-03-15 19:21:38 +03:00
Svyatoslav Kuzmich 4005b5ce10 [JS IR BE] Fix fqNames in moveBodilessDeclarationsToSeparatePlace 2019-03-15 13:53:20 +03:00
Ting-Yuan Huang 6bbb0269b1 IR: Set when.origin for IrIfElseImpl
Change-Id: I38510b59e3dc936baadbfe3ef2702990493815e5
2019-03-13 08:48:20 +01:00
Alexander Udalov 9d94a54f03 Simplify ExternalDependenciesGenerator
Remove unused parameters, inline inner class
2019-03-05 16:28:34 +01:00