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.
This commit is contained in:
@@ -182,12 +182,17 @@ public class DescriptorUtils {
|
||||
|
||||
@NotNull
|
||||
public static ModuleDescriptor getContainingModule(@NotNull DeclarationDescriptor descriptor) {
|
||||
ModuleDescriptor module = getContainingModuleOrNull(descriptor);
|
||||
assert module != null : "Descriptor without a containing module: " + descriptor;
|
||||
return module;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static ModuleDescriptor getContainingModuleOrNull(@NotNull DeclarationDescriptor descriptor) {
|
||||
if (descriptor instanceof PackageViewDescriptor) {
|
||||
return ((PackageViewDescriptor) descriptor).getModule();
|
||||
}
|
||||
ModuleDescriptor module = getParentOfType(descriptor, ModuleDescriptor.class, false);
|
||||
assert module != null : "Descriptor without a containing module: " + descriptor;
|
||||
return module;
|
||||
return getParentOfType(descriptor, ModuleDescriptor.class, false);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
Reference in New Issue
Block a user