Buggy code:
public abstract class ElementResolver { protected final ResolveSession resolveSession ; protected ElementResolver ( @ NotNull ResolveSession session ) { } @ NotNull public BindingContext getElementAdditionalResolve ( @ NotNull JetElement jetElement ) { } @ NotNull public BindingContext resolveToElement ( @ NotNull JetElement jetElement ) { } @ NotNull protected ProbablyNothingCallableNames probablyNothingCallableNames ( ) { } @ NotNull public BindingContext resolveToElement ( @ NotNull JetElement jetElement , BodyResolveMode bodyResolveMode ) { } @ NotNull protected BindingContext elementAdditionalResolve ( @ NotNull JetElement resolveElement , @ NotNull JetElement contextElement , @ NotNull BodyResolveMode bodyResolveMode ) { } private static void packageRefAdditionalResolve ( ResolveSession resolveSession , BindingTrace trace , JetElement jetElement ) { } private static void typeConstraintAdditionalResolve ( KotlinCodeAnalyzer analyzer , JetTypeConstraint jetTypeConstraint ) { } private void codeFragmentAdditionalResolve ( ResolveSession resolveSession , JetCodeFragment codeFragment , BindingTrace trace , BodyResolveMode bodyResolveMode ) { } private static void annotationAdditionalResolve ( ResolveSession resolveSession , JetAnnotationEntry jetAnnotationEntry ) { } private static Annotations getAnnotationsByDeclaration ( ResolveSession resolveSession , JetModifierList modifierList , JetDeclaration declaration ) { } private static void typeParameterAdditionalResolve ( KotlinCodeAnalyzer analyzer , JetTypeParameter typeParameter ) { } private void delegationSpecifierAdditionalResolve ( ResolveSession resolveSession , JetDelegationSpecifierList specifier , BindingTrace trace , JetFile file ) { } private void propertyAdditionalResolve ( final ResolveSession resolveSession , final JetProperty jetProperty , BindingTrace trace , JetFile file , @ NotNull PartialBodyResolveProvider partialResolveProvider ) { } private void functionAdditionalResolve ( ResolveSession resolveSession , JetNamedFunction namedFunction , BindingTrace trace , JetFile file , @ NotNull PartialBodyResolveProvider partialResolveProvider ) { } private void constructorAdditionalResolve ( ResolveSession resolveSession , JetClass klass , BindingTrace trace , JetFile file , @ NotNull PartialBodyResolveProvider partialResolveProvider ) { } private void initializerAdditionalResolve ( ResolveSession resolveSession , JetClassInitializer classInitializer , BindingTrace trace , JetFile file , @ NotNull PartialBodyResolveProvider partialResolveProvider ) { } private BodyResolver createBodyResolver ( ResolveSession resolveSession , BindingTrace trace , JetFile file , @ NotNull PartialBodyResolveProvider partialResolveProvider ) { } private static TopDownAnalysisParameters createParameters ( @ NotNull ResolveSession resolveSession ) { } @ NotNull private static ElementResolver . BodyResolveContextForLazy createEmptyContext ( @ NotNull ResolveSession resolveSession ) { } private static JetScope getExpressionResolutionScope ( @ NotNull ResolveSession resolveSession , @ NotNull JetExpression expression ) { } private static JetScope getExpressionMemberScope ( @ NotNull ResolveSession resolveSession , @ NotNull JetExpression expression ) { BindingTrace trace = resolveSession . getStorageManager ( ) . createSafeTrace ( new DelegatingBindingTrace ( resolveSession . getBindingContext ( ) , "trace<seq2seq4repair_space>to<seq2seq4repair_space>resolve<seq2seq4repair_space>a<seq2seq4repair_space>member<seq2seq4repair_space>scope<seq2seq4repair_space>of<seq2seq4repair_space>expression" , expression ) ) ; if ( BindingContextUtils . isExpressionWithValidReference ( expression , resolveSession . getBindingContext ( ) ) ) { QualifiedExpressionResolver qualifiedExpressionResolver = resolveSession . getQualifiedExpressionResolver ( ) ; if ( ( expression . getParent ( ) ) instanceof JetUserType ) { JetUserType qualifier = ( ( JetUserType ) ( expression . getParent ( ) ) ) . getQualifier ( ) ; if ( qualifier != null ) { JetScope resolutionScope = ElementResolver . getExpressionResolutionScope ( resolveSession , expression ) ; <START_BUG> Collection < DeclarationDescriptor > descriptors = qualifiedExpressionResolver . lookupDescriptorsForUserType ( qualifier , resolutionScope , trace ) ; <END_BUG> for ( DeclarationDescriptor descriptor : descriptors ) { if ( descriptor instanceof LazyPackageDescriptor ) { return ( ( LazyPackageDescriptor ) ( descriptor ) ) . getMemberScope ( ) ; } } } } if ( ( PsiTreeUtil . getParentOfType ( expression , JetImportDirective . class , false ) ) != null ) { PackageViewDescriptor rootPackage = resolveSession . getModuleDescriptor ( ) . getPackage ( ROOT ) ; assert rootPackage != null ; if ( ( expression . getParent ( ) ) instanceof JetDotQualifiedExpression ) { JetExpression element = ( ( JetDotQualifiedExpression ) ( expression . getParent ( ) ) ) . getReceiverExpression ( ) ; FqName fqName = expression . getContainingJetFile ( ) . getPackageFqName ( ) ; PackageViewDescriptor filePackage = resolveSession . getModuleDescriptor ( ) . getPackage ( fqName ) ; assert filePackage != null : "File<seq2seq4repair_space>package<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>already<seq2seq4repair_space>resolved<seq2seq4repair_space>and<seq2seq4repair_space>be<seq2seq4repair_space>found" ; JetScope scope = filePackage . getMemberScope ( ) ; Collection < ? extends DeclarationDescriptor > descriptors ; if ( element instanceof JetDotQualifiedExpression ) { descriptors = qualifiedExpressionResolver . lookupDescriptorsForQualifiedExpression ( ( ( JetDotQualifiedExpression ) ( element ) ) , rootPackage . getMemberScope ( ) , scope , trace , EVERYTHING , false ) ; } else { descriptors = qualifiedExpressionResolver . lookupDescriptorsForSimpleNameReference ( ( ( JetSimpleNameExpression ) ( element ) ) , rootPackage . getMemberScope ( ) , scope , trace , EVERYTHING , false , false ) ; } for ( DeclarationDescriptor descriptor : descriptors ) { if ( descriptor instanceof PackageViewDescriptor ) { return ( ( PackageViewDescriptor ) ( descriptor ) ) . getMemberScope ( ) ; } } } else { return rootPackage . getMemberScope ( ) ; } } JetPackageDirective packageDirective = PsiTreeUtil . getParentOfType ( expression , JetPackageDirective . class , false ) ; if ( packageDirective != null ) { PackageViewDescriptor packageDescriptor = resolveSession . getModuleDescriptor ( ) . getPackage ( packageDirective . getFqName ( ( ( JetSimpleNameExpression ) ( expression ) ) ) . parent ( ) ) ; if ( packageDescriptor != null ) { return packageDescriptor . getMemberScope ( ) ; } } } return null ; } @ NotNull protected abstract AdditionalCheckerProvider getAdditionalCheckerProvider ( @ NotNull JetFile jetFile ) { } private static class BodyResolveContextForLazy implements BodiesResolveContext { private final Function < ? super JetDeclaration , JetScope > declaringScopes ; private final TopDownAnalysisParameters topDownAnalysisParameters ; private BodyResolveContextForLazy ( @ NotNull TopDownAnalysisParameters parameters , @ NotNull Function < ? super JetDeclaration , JetScope > declaringScopes ) { } @ NotNull @ Override public StorageManager getStorageManager ( ) { } @ NotNull @ Override public ExceptionTracker getExceptionTracker ( ) { } @ Override public Collection < JetFile > getFiles ( ) { } @ Override public Map < JetClassOrObject , ClassDescriptorWithResolutionScopes > getDeclaredClasses ( ) { } @ Override public Map < JetClassInitializer , ClassDescriptorWithResolutionScopes > getAnonymousInitializers ( ) { } @ Override public Map < JetProperty , PropertyDescriptor > getProperties ( ) { } @ Override public Map < JetNamedFunction , SimpleFunctionDescriptor > getFunctions ( ) { }

Fix:
Collection < DeclarationDescriptor > descriptors = qualifiedExpressionResolver . lookupDescriptorsForUserType ( qualifier , resolutionScope , trace , false ) ;