Commit Graph

413 Commits

Author SHA1 Message Date
Alexander Udalov cbaa676c3d Move some declarations between 'descriptors' and 'deserialization'
- Move the following from 'deserialization' to 'descriptors':
  NotFoundClasses.kt
  AdditionalClassPartsProvider.kt
  ClassDescriptorFactory.kt
  PlatformDependentDeclarationFilter.kt
  findClassInModule.kt
- Move the following form 'descriptors' to 'deserialization':
  BuiltInSerializerProtocol.kt
  builtInsPackageFragmentProvider.kt
- Extract a marker interface from BuiltInsPackageFragment and move its
  implementation to 'deserialization'
- Change the type of parameters in PlatformDependentDeclarationFilter
  and AdditionalClassPartsProvider to ClassDescriptor

This will help in getting rid of the circular dependency of
'descriptors' <-> 'deserialization'
2017-06-06 14:29:18 +03:00
Dmitry Petrov fd1866b838 Do not check argumentMapping.isError()
Argument matching status can be considered an "error" in resolve,
even though it is not a compilation error and doesn't prevent code
from being generated.
Actually, we should only check if the argument matching status is
ArgumentMatch.

 #KT-18294 Fixed
2017-06-06 10:19:18 +03:00
Dmitry Petrov 978661c53d Do not generate default parameter values for synthetic functions
This causes a subtle issue with 'copy' function for data class,
which has parameters with source elements corresponding to
the data class primary constructor parameters: default value expression
for such parameters is generated second time (to be overwritten later),
which creates duplicate bindings if such expression included any
(possibly anonymous) declarations, such as lambdas or anonymous objects.

 #KT-18208 Fixed
2017-06-02 10:57:45 +03:00
Dmitry Petrov 30182c38ce Fix toString and hashCode for array members of data classes
Generate them as special intrinsics that would be mapped to proper
platform-specific calls by BEs.

 #KT-16945 Fixed
2017-05-26 09:32:29 +03:00
Dmitry Petrov 1420926a9b Generate receivers for callable references in the same way as for calls
Properly handle callable members imported from objects
and other related corner cases.

 #KT-18084 Fixed
2017-05-26 09:32:29 +03:00
Dmitry Petrov 425c66b0cd Separate stub generation for external dependencies from PSI2IR 2017-05-24 11:18:52 +03:00
Dmitry Petrov 952f53d37c Use DeclarationStubGenerator for built-ins initialization 2017-05-24 11:18:52 +03:00
Dmitry Petrov ec9427a36b Minor: make DeepCopySymbolsRemapper open 2017-05-24 11:18:52 +03:00
Dmitry Petrov e7eb078c3f Minor: remove always true is-check 2017-05-24 11:18:52 +03:00
Dmitry Petrov 6fd762cfce Provide DeclarationStubGenerator as a separate class in IR utilities 2017-05-24 11:18:52 +03:00
Dmitry Petrov 7204a929f3 Move SymbolTable to common IR utilities 2017-05-24 11:18:52 +03:00
Denis Zharkov 52b2e632df Simplify generated code for rangeTo/concat intrinsics
The main reason is avoiding complicated operations like
dup + dup_x2 + pop2 for instances obtained by NEW instruction.

Otherwise it leads to problems in performRefinedTypeAnalysis
because code there has a sensible assumption that NEW instances
can be only dupped or stored into a local (rare cases)

 #KT-17457 Fixed
2017-05-22 14:51:04 +03:00
Dmitry Petrov 2cda5aaeb5 Additional customization for DeepCopyIrTreeWithSymbols
1. Allow overriding 'getNonTransformedLoop'
2. Allow descriptor remapping on deep copy
2017-05-19 14:49:34 +03:00
Dmitry Petrov b9dee7fcf3 Extract SymbolRemapper interface for DeepCopy customization 2017-05-19 14:49:34 +03:00
Mikhael Bogdanov daf6768181 Add proper DefaultLambda initialization,
patch lambda related instructions in default method

Remove default lambda linked instructions from default method
2017-05-11 11:06:46 +02:00
Dmitry Petrov e902cff937 Add 'getTypeArgumentOrDefault' extension for IrMemberAccessExpression 2017-05-05 09:59:30 +03:00
Dmitry Petrov f5fde2c24f Dump absent type arguments 2017-05-05 09:59:30 +03:00
Dmitry Petrov ddb2b7508b Generate property initializer within property scope 2017-05-05 09:59:30 +03:00
Dmitry Petrov 8e84862afa Generate do-while condition within loop body scope 2017-05-05 09:59:30 +03:00
Dmitry Petrov fdb4de355c Use original descriptors to create symbols for callable references 2017-05-05 09:59:30 +03:00
Dmitry Petrov c2601c947f Postpone call arguments generation in compound assignment expressions
Otherwise RHS is generated twice, causing ISE in symbol binding
2017-05-05 09:59:30 +03:00
Dmitry Petrov d5feb2d6f4 Deep copy fixes + sanitize file names for module dumps 2017-05-04 13:51:17 +03:00
Dmitry Petrov b83620fdb9 Minor: DeepCopyIrTree: make some utility methods 'protected' 2017-05-04 09:33:03 +03:00
Dmitry Petrov e600a1af30 Minor: IrDeclarationOrigin.NEW_INSTANCE_RECEIVER -> INSTANCE_RECEIVER 2017-05-04 09:33:03 +03:00
Dmitry Petrov 1eb693b8ee Transform variable-as-function calls for extension functions
In the following code example
  fun test(f: Any.() -> Unit) = 42.f()
front-end resolves variable-as-function call for 'f' as 'invoke'
with signature 'Function1<Any, Unit>#Any.() -> Unit'.
However, Function1<Any, Unit> has a single 'invoke' method
with signature 'Function1<Any, Unit>#(Any) -> Unit'.
This didn't cause any problems with loosely typed JVM and JS back-ends.
However, in IR with symbols this means a reference to non-existing
declaration.
2017-05-04 09:33:03 +03:00
Dmitry Petrov 7bd75df1f1 Minor: small refactorings in IrElementTransformerVoid 2017-05-04 09:33:03 +03:00
Dmitry Petrov 0203ba4dff Use stable order when generating stubs for scope members 2017-05-04 09:33:03 +03:00
Dmitry Petrov 40939da9fb Minor: DeclarationGeneratorExtension already extends Generator 2017-05-04 09:33:03 +03:00
Dmitry Petrov 17706d0fb6 Generate parameter declarations for synthetic members of enum classes 2017-05-04 09:33:03 +03:00
Dmitry Petrov 78a601af87 Generate parameter declarations for fake overrides 2017-05-04 09:33:03 +03:00
Dmitry Petrov fa4dc26814 Put 'thisReceiver' declaration in class
Interfaces also have 'thisReceiver'
2017-05-04 09:33:03 +03:00
Dmitry Petrov 90ec53b3b0 Generate catch-block body within proper scope 2017-05-04 09:33:03 +03:00
Dmitry Petrov acefd0d891 Minor refactor and fix in Scope constructors 2017-05-04 09:33:03 +03:00
Dmitry Petrov 54294eaaa7 Minor fix and deprecation in DeepCopyIrTree 2017-05-04 09:33:03 +03:00
Dmitry Petrov 4dd199fedf OldDeepCopyIrTree --> DeepCopyIrTree (for migration) 2017-05-04 09:33:03 +03:00
Dmitry Petrov d5fb0f3f32 Minor: simplify code in generateEnumConstructorCallOrSuperCall 2017-05-04 09:33:03 +03:00
Dmitry Petrov 5ec9cb3171 OldDeepCopyIrTree: old DeepCopyIrTree working with new IrElement hierarchy 2017-05-04 09:33:03 +03:00
Dmitry Petrov b53807ab83 Drop IrBuiltinsOperatorsBuilder 2017-05-04 09:33:03 +03:00
Dmitry Petrov de7b7ce6d5 Generate anonymous initializer body in separate scope 2017-05-04 09:33:03 +03:00
Dmitry Petrov 9c3387e174 Deprecate IrMemberFunctionBuilder 2017-05-04 09:33:03 +03:00
Dmitry Petrov 6f2c8140cf IrDelegatingConstructorCall should have substituted descriptor 2017-05-04 09:33:03 +03:00
Dmitry Petrov 6e79709ef1 Simplify helper methods in SymbolTable auxiliary classes 2017-05-04 09:33:03 +03:00
Dmitry Petrov a511540aad Render receivers as 'this@owner: type'
Add test for generic inner class with generic outer class.
2017-05-04 09:33:03 +03:00
Dmitry Petrov 1bf6f8fc57 Do not generate separate type parameter declarations for constructors 2017-05-04 09:33:03 +03:00
Dmitry Petrov 57b2a4461c Call IrSymbol.bind in declaration constructors 2017-05-04 09:33:03 +03:00
Dmitry Petrov 208bf5c667 Bind declaration symbols in DeepCopyIrTree.
Check that symbols are bound.
2017-05-04 09:33:03 +03:00
Dmitry Petrov a840cf7643 Fix source range tests: support "undefined" offsets 2017-05-04 09:33:03 +03:00
Dmitry Petrov 40e09a39c1 Fix prototype JVM BE tests 2017-05-04 09:33:03 +03:00
Dmitry Petrov 2b0d3440ad Descriptors in calls are substituted,
and symbols refer to the original descriptors.
2017-05-04 09:33:03 +03:00
Dmitry Petrov d7a362b4f6 Binding: all current tests are green. 2017-05-04 09:33:03 +03:00