Commit Graph

294 Commits

Author SHA1 Message Date
Alexander Udalov 45190d9453 Support separate modules in compiler
Unless the compatibility option "-Xsingle-module" is passed, the compiler will
create two modules instead of one now (see TopDownAnalyzerFacadeForJVM): the
main module contains Kotlin and Java sources and binaries from the previous
compilation of the given module chunk, the dependency module contains all other
Kotlin and Java binaries. This fixes some issues where the compiler couldn't
detect that the used symbol was from another module, and did not forbid some
usages which are only possible inside the module (see KT-10001).

The ideal way to deal with modules here would be to exactly recreate the
project structure, for example as it's done in JvmAnalyzerFacade and usages.
This is postponed until later

 #KT-10001 Fixed
 #KT-11840 In Progress
2016-10-02 21:15:47 +03:00
Dmitry Petrov 07198cf86d SAM constructors for type aliases. 2016-09-22 10:38:34 +03:00
Alexander Udalov 090d157f86 Update test data for data classes 2016-09-15 16:45:48 +03:00
Alexander Udalov 127e7ab5b7 Reflection: add KClass.typeParameters, KCallable.typeParameters
Inheritance from KCallable is removed in kt9078.kt because it was irrelevant to
the test and because it gets in the way of modification of KCallable
2016-08-08 17:54:11 +03:00
Mikhail Glukhikh b56e84d47f Cast never succeeds: special 'Nothing' / 'Nothing?' case
(cherry picked from commit 63435b4)
2016-07-27 10:52:13 +03:00
Alexander Udalov 9be219b69c Check presence of dispatch receiver parameter in modifier checks
Also fix typo in "inapplicable infix" diagnostic message
2016-07-22 18:13:39 +03:00
Alexander Udalov ff72348105 Report error on protected setter call from super's companion
#KT-12847 Fixed
2016-06-29 22:03:35 +03:00
Alexander Udalov 6ba32ed624 Refactor CallChecker and subclasses
Encapsulate everything that is needed in checkers into CallCheckerContext. Pass
an instance of this context instead of BasicCallResolutionContext to checkers.

Also pass an instance of the element to report errors on: this is useful
because before this, every checker had its own way of determining where should
the error be reported on. Some of them, for example, were not doing anything if
Call#calleeExpression returned null, which is wrong, see operatorCall.kt

 #KT-12875 Open
2016-06-29 19:20:00 +03:00
Nikolay Krasko eee45e91ce Add more tests for PropertyAccessorDescriptor.isDeafult() usages 2016-06-29 16:16:31 +03:00
Stanislav Erokhin 01430b4b99 Create hack for exception about "Empty intersection for types".
Hackaround for KT-11266, EA-79963, EA-72093,  EA-79976.
2016-06-17 01:39:44 +03:00
Mikhail Glukhikh be40cf8138 KT-12152 : constructor consistency: distinguish properties with and w/o backing fields, with default / custom accessors 2016-06-03 09:45:49 +03:00
Denis Zharkov d0acb3674a Fix rendered testData
New members in enum member scope
2016-05-16 15:38:13 +03:00
Alexander Udalov 117d0bcf03 Fix multiple exceptions related to subtypes of function types
The main change is in FunctionsTypingVisitor#visitLambdaExpression, where we
incorrectly allowed subtypes of function types to be expected type during
resolution of lambdas

Also see EA-70485

 #KT-9820 Fixed
2016-03-14 19:24:17 +03:00
Mikhail Glukhikh f76efb68f2 Strictfp on a class is now a warning #KT-11109 Fixed 2016-03-12 13:17:11 +03:00
Dmitry Petrov 8660800af7 Constraint system builder shouldn't drop nullability when comparing signatures for specificity. 2016-03-03 19:23:43 +03:00
Alexander Udalov 8e77e16bbd Remove leftovers of platformName and platformStatic in test data
Drop unnecessary imports, rename some tests
2016-03-02 16:47:04 +03:00
Dmitry Petrov eb7cf92fbd Minor. Add a test for KT-10732: no redeclaration for
fun <T> List<T>?.foo()
fun <T> List<T>.foo()
2016-03-01 13:54:03 +03:00
Pavel V. Talanov a4c005fefd Update existing test data depending on diagnostic parameter rendering 2016-02-26 14:45:11 +03:00
Michael Bogdanov 1b94904684 Prohibited @Strictfp annotation on classes (it's not supported yet), Fix for KT-11109: Strictfp annotation do nothing when applied to class
#KT-11109 Fixed
2016-02-25 18:07:51 +03:00
Alexander Udalov 1b8f934b54 Delete deprecated enum 'values' property 2016-02-19 22:28:44 +03:00
Mikhail Glukhikh 7da981e12c Regression tests #KT-8168 Obsolete 2016-02-05 18:29:40 +03:00
Dmitry Petrov e4583fd275 Do not report IMPLICIT_CAST_TO_ANY on last statement of lambda with Unit(?) in at least one branch. 2016-02-05 10:44:50 +03:00
Mikhail Glukhikh 60d56b30bf Safe call arguments are now handled as nullable in generic resolver #KT-9985 Fixed 2016-02-03 18:34:10 +03:00
Yan Zhulanow da7acd5e73 Check annotations on default property getter/setter 2016-02-02 13:14:56 +03:00
Ilya Gorbunov 911940d458 InlineOnly annotation suppresses NOTHING_TO_INLINE diagnostics. 2016-01-28 19:37:44 +03:00
Mikhail Glukhikh 12b100c541 Regression test #KT-9529 Obsolete 2016-01-28 12:56:12 +03:00
Alexander Udalov 04026dbe84 Make Array<T>(size, init) a constructor of Array
It's not marked as inline, this is why 'crossinline' was added in
jaggedArray.kt/jaggedDeep.kt. Will be fixed in the following commits
2016-01-28 03:10:37 +03:00
Dmitry Petrov 9db3440e72 Fix type inference issues for 'if' and 'when'.
Use 'expectedType' (when present) as an explicit type argument for a special construct call.
Unfortunately, this approach can't be used for elvis due to other elvis-related inference hacks.
Fixes KT-10807, KT-10811.
This also affects KT-6189: now we can infer proper type for 'if'.

If type inference for special call failed, and we found no type errors in sub-expressions,
report TYPE_INFERENCE_FAILED_ON_SPECIAL_CONSTRUCT error.
This (and the hack above) fixes KT-10809: code no longer compiles.
2016-01-27 17:07:20 +03:00
Mikhail Glukhikh d94930149b Warning for open members in objects 2016-01-26 19:04:17 +03:00
Mikhail Glukhikh 1b8f938260 Report EXPOSED_PROPERTY_TYPE on a property name only #KT-10760 Fixed 2016-01-26 19:04:13 +03:00
Stanislav Erokhin e53e152f83 Removed hacks for code migration from ConstraintSystemImpl. 2016-01-25 21:53:09 +03:00
Stanislav Erokhin 210c9ab3db Minor. Added regression tests for: KT-3927, KT-9522, KT-10036, KT-7440, KT-9682, KT-9808, KT-9517, KT-9810, KT-9345. 2016-01-25 19:13:32 +03:00
Denis Zharkov 6c0cd70a22 Introduce PureReifiable annotation
It prevents reporting unsafe substitution warning on expressions
like 'arrayOf(arrayOf(""))'
2016-01-22 19:17:22 +03:00
Denis Zharkov 4cf1393e81 Minor. Render annotations on type parameters 2016-01-22 19:17:22 +03:00
Denis Zharkov ae6c62ddff Minor. Report reified-related diagnostics on arguments if possible 2016-01-22 19:17:22 +03:00
Dmitry Petrov f371e67ce8 PatternMatchingTypingVisitor:
rewrite type inference for 'when' using special constructs.
This fixes several type inference issues for 'when':
KT-9929, KT-9972, KT-10439, KT-10463
along with some other diagnostics-related issues.
2016-01-22 10:41:55 +03:00
Michael Bogdanov 829978a37d Added additional parameter for default methods 2016-01-22 10:10:32 +03:00
Ilya Gorbunov 25c4453dc5 Cleanup deprecated symbol usages in testData 2016-01-22 05:54:38 +03:00
Ilya Gorbunov 2813840769 Fix testData: diagnostics changed. 2016-01-22 05:54:38 +03:00
Ilya Gorbunov f4822cd757 Fix testData in compiler: add collections and ranges package to fq-names. 2016-01-22 05:54:38 +03:00
Valentin Kipyatkov d749f85a60 Inaccessible classes from the current package to not conflict with visible classes from somewhere else 2016-01-19 19:30:18 +03:00
Mikhail Glukhikh e4f7446bec JvmSynthetic forbidden for delegated properties (and searched for different use-site targets) 2016-01-19 11:38:53 +03:00
Mikhail Glukhikh a2bba7c8f1 JvmField forbidden for delegated properties 2016-01-19 11:38:49 +03:00
Mikhail Glukhikh ec909d0775 Volatile forbidden for delegated properties (and checked for other use-site targets) 2016-01-19 11:38:45 +03:00
Mikhail Glukhikh b78d481bb1 delegate use-site targeted annotations: parser, front-end, codegen with some tests #KT-10502 Fixed 2016-01-19 11:38:41 +03:00
Denis Zharkov e9693e987f Humanize type mismatch diagnostic caused by type projections
#KT-10581 Fixed
2016-01-19 11:05:41 +03:00
Stanislav Erokhin b185316a6e Create new HidesMembers annotation 2016-01-15 23:32:34 +03:00
Valentin Kipyatkov 5a079defc7 "Rename on import" hides importing of the same symbol by other imports with the original name 2016-01-14 17:05:28 +03:00
Dmitry Petrov 609ffc10a9 KT-10322, KT-10646, KT-10647:
- update diagnostic to (supposedly) more useful
- also report IMPLICIT_CAST_TO_ANY if expected type is DONT_CARE
 (effectively "no expected type" for lambda expression).
2016-01-14 10:08:20 +03:00
Michael Bogdanov 91f27ba176 Report error on 'JvmStatic' annotation on const or @JvmField property
#KT-10415 Fixed
2015-12-29 17:20:07 +03:00