Commit Graph

1259 Commits

Author SHA1 Message Date
Nikolay Krasko 2946c1d6a8 KT-7271 Accessing an extension property of Char.Companion leads to ClassNotFoundException in runtime
#KT-7271 Fixed
2015-04-07 15:59:05 +03:00
Mikhail Glukhikh 88441814b9 Test for KT-5502 (works after KT-4450 / KT-5907 fix) 2015-04-06 18:32:19 +03:00
Mikhail Glukhikh d92ccad35d Implementation and tests for KT-5840 and newly created KT-7204. Now a safe call provides not-null receiver state *inside* argument list. It works also for ?. chains. #KT-5840 Fixed.
On the other hand, argument states do not propagate to successor statements for a safe call. #KT-7204 Fixed. A few additional comments.
2015-04-06 18:29:52 +03:00
Dmitry Jemerov 252c4118eb report 'break' and 'continue' inside 'when' as errors (even if 'when' is nested in a loop) 2015-04-05 00:33:14 +03:00
Ilya Ryzhenkov 2f02024c24 checkLValue for array indexing expression should resolve set method #KT-7218 Fixed 2015-04-01 21:02:05 +03:00
Pavel V. Talanov a986d913c3 Remove traces of class object constraints feature from parser, frontend, tests and psi 2015-04-01 20:09:34 +03:00
Svetlana Isakova 61d0bcdf76 KT-7068 None of the following functions can be called with two functions with extention function parameter
#KT-7068 Fixed
2015-04-01 11:57:15 +03:00
Denis Zharkov 99f1ab333e Report illegal modifiers and annotations on primary constructor
#KT-7057 Fixed
 #KT-6772 Fixed
2015-03-31 20:20:22 +03:00
Mikhail Glukhikh 620b7954ac Tests for already working KT-3993 and KT-5427. These test cases pass at least since M11 2015-03-31 17:15:46 +03:00
Mikhail Glukhikh 9c1551bca9 Implementation of smart casts for public / protected immutable properties that are not open and used in the same module.
DataFlowValueFactory and its environment refactoring: containing declaration is added into factory functions
as an argument and used to determine identifier stability. A few minor fixes. #KT-5907 Fixed. #KT-4450 Fixed. #KT-4409 Fixed.

New tests for KT-4409, KT-4450, KT-5907 (public and protected value properties used from the same module or not,
open properties, variable properties, delegated properties, properties with non-default getter).
Public val test and KT-362 test changed accordingly.
2015-03-31 16:19:03 +03:00
Denis Zharkov 418034add3 Prohibit instance access before super call
- Before this change members just left unresolved as they were absent in the
  specific scope named scopeForSecondaryConstructorHeaderResolution that
  created just to prohibit such accesses.
- Now they are resolved the same way as other members, but diagnostic is
  repored by in-place injected CallChecker
- Drop obsolete type of class scope

 #KT-6995 Fixed
2015-03-27 20:15:00 +03:00
Denis Zharkov d0c72c2c3d Mark value arguments in case of empty delegation call
It's useful for quickfixes for these diagnostics
2015-03-27 16:09:41 +03:00
Denis Zharkov 023e1a13a9 Do not try to detect cycles if delegation call resolution is unsuccessful 2015-03-27 16:09:41 +03:00
Denis Zharkov 7aa2642a2b Unify reporting resolution errors for empty delegation calls
- Always report "There is no applicable constructor for call without arguments in superclass"
  under `constructor` keyword by replacing default TracingStrategy
- Remove positioning strategy used for reporting non-applicable
  for empty delegation calls

 #KT-6971 Fixed
2015-03-27 16:09:41 +03:00
Denis Zharkov 29b03e8175 Report illegal modifiers on secondary constructors 2015-03-27 16:09:41 +03:00
Denis Zharkov 8aa4e9bd94 Report error for inappropriate modifiers usages 2015-03-27 16:09:40 +03:00
Denis Zharkov 01e5ee718f Allow secondary constructors without body
#KT-6967 Fixed
2015-03-27 16:09:40 +03:00
Denis Zharkov bd5dbb665e Fix header scope for secondary constructors
Add companion object's scope and nested classes

 #KT-6996 fixed
2015-03-18 19:59:24 +03:00
Stanislav Erokhin 43e24f6b0d Fixed test data for new lambda syntax 2015-03-18 16:06:44 +03:00
Stanislav Erokhin 371908a280 Temporary added DEPRECATED_LAMBDA_SYNTAX to tests.
It will be fixed soon.
2015-03-18 16:06:44 +03:00
Stanislav Erokhin 47e8b1e77c Create warning for old lambda syntax. 2015-03-18 16:06:44 +03:00
Stanislav Erokhin 446816e3db Created automatic labeling of function expression. 2015-03-18 16:06:44 +03:00
Denis Zharkov 36665fe3b8 Change logic of constructor delegation call resolution
- If class has type arguments (A<T1,..>) then
  resolve it's delegation call to `this` as for expression A<T1, ..>()
  like type arguments are explicitly specified.

- Same logic works for `super` delegation calls.

- It could be just enough to substitute all candidates before resolve
  but diagnostic messages looks more correct when substitution is
  performed within CandidateResolver.performResolutionForCandidateCall
  because it works the same way as when resolving A<T1, ..>().

 #KT-6992 Fixed
 #KT-6993 Fixed
 #KT-6994 Fixed
2015-03-17 23:18:35 +03:00
Denis Zharkov 9cecd69a9e Drop unneeded condition that leads to error
This check is obsolete but leads to problems.

It appears when resolving recursive calls (see sameTypeParameterUse.kt):

`foo<R>(x: R, y: R)` within call `foo<R>(x, "")` after substitution
has R as type of it's second argument, and when checking value arguments,
x is not checked because supposed to be dependent on type parameter of candidate
(that is effectively false), so there are two successful candidates
in resolution results and wrong OVERLOAD_RESOLUTION_AMBIGUITY error.
2015-03-17 23:18:34 +03:00
Denis Zharkov 9e5192e0e3 Prohibit val/vars/modifiers on secondary constructor parameter
#KT-6962 Fixed
2015-03-17 23:18:33 +03:00
Pavel V. Talanov 06916d98c6 default -> companion: replace all mentions of default and default object 2015-03-17 15:47:39 +03:00
Nikolay Krasko 8c5109d819 Generate descriptor for trait constructor. Exception is thrown otherwise...
EA-38416, EA-65189, EA-60850
2015-03-16 20:16:25 +03:00
Alexander Udalov e5d5b49ce2 Fix exception from ::class literals on unresolved classes 2015-03-12 23:14:55 +03:00
Stanislav Erokhin 8accdcc5cb Fix type inference for function expression parameters 2015-03-12 17:11:53 +03:00
Stanislav Erokhin f47f285868 Expected function type used for parameter types inference in function expression 2015-03-12 17:11:53 +03:00
Stanislav Erokhin 639003b8a8 Allowed function parameter without type declaration in the parser 2015-03-12 17:11:52 +03:00
Stanislav Erokhin d9882a6d0b Move inference parameter type in FunctionDescriptorResolver 2015-03-12 17:11:52 +03:00
Stanislav Erokhin 929f1bc9ba Fixed method hasTypeParameterListBeforeFunctionName in JetNamedFunction 2015-03-12 17:11:47 +03:00
Stanislav Erokhin 44895a23cf Frontend support for function as expression 2015-03-12 17:11:46 +03:00
Stanislav Erokhin 560c32c0f1 Added diagnostic error when in function declaration name was omitted 2015-03-12 17:11:44 +03:00
Stanislav Erokhin a33450395c Resolve parenthesized element as expression 2015-03-12 17:11:43 +03:00
Stanislav Erokhin 3b92cab9e0 Changed containing declaration for PropertyDeclarationInnerScope 2015-03-12 17:11:43 +03:00
Nikolay Krasko dcd29cb65d Revert "Generate descriptor for trait constructor. Exception is thrown otherwise (EA-38416)"
This reverts commit 6ba120bba8.
2015-03-12 14:18:22 +03:00
Nikolay Krasko 6ba120bba8 Generate descriptor for trait constructor. Exception is thrown otherwise (EA-38416) 2015-03-12 12:59:22 +03:00
Pavel V. Talanov 2987e72d29 Do not report redeclaration when outer class and default object's members clash
Previously we prohibited classes and properties with the same name (now it's unnecessary)
Add test for backends that they support qualified (by default object name) member references inside class body
2015-03-11 21:06:05 +03:00
Andrey Breslav 61989ba245 KT-6815 Representing raw types when used as supertypes for Java classes
#KT-6815 Fixed
2015-03-11 18:27:37 +03:00
Andrey Breslav e0b7e4efca KT-6803 Subtyping breaks on star-projections for recursive generics
Star-projections have upper bounds of the form "parameter's bound where all parameter of the same class are substituted with their star-projections"

  #KT-6803 Fixed
2015-03-11 18:27:36 +03:00
Denis Zharkov 70c573864a Prohibit DelegationBy specifier when no primary constructor
Also add codegen test for case when there is primary
2015-03-11 17:45:29 +03:00
Denis Zharkov 582755e71a Don't generate empty constructor if there is secondary one with empty parameter list 2015-03-11 17:45:29 +03:00
Denis Zharkov aab706a6a6 Revert test checking ENUM_ENTRY_ILLEGAL_TYPE 2015-03-11 17:45:28 +03:00
Denis Zharkov 5eb4dcd913 Report conflicting overloads for constructors
- It's worked almost fine but diagnostics were filtered out by
  positioning strategy.

- Also a couple of "put" calls to Multimap are replaced by "putValues"
  within OverloadResolver, that is more semantically correct.

- Note that constructors of top-level classes are handled when processing
  package, it helps to figure out if there are clashes with top-level
  functions that have the same name.

- But constructors of different classes are not reported as
  overloads because containing classes has the same name and will be
  reported as redeclaration.
2015-03-11 17:45:28 +03:00
Denis Zharkov 9d2d3c0c7b Take data flow info from delegation call 2015-03-11 17:45:28 +03:00
Denis Zharkov aa5599f6ca Improve positioning strategy for delegation calls 2015-03-11 17:45:28 +03:00
Denis Zharkov 67f97fea42 Prohibit data classes with no primary constructor 2015-03-11 17:45:28 +03:00
Denis Zharkov 4c26d037d9 Resolve property initializer if there is no primary constructor 2015-03-11 17:45:27 +03:00