mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
[java] [inference] fix explicit type lambda pertinent to applicability check (IDEA-279477)
GitOrigin-RevId: f5249362b724b60a4cac5d3856f03f61743d7266
This commit is contained in:
committed by
intellij-monorepo-bot
parent
8b9d0c44be
commit
8e5bc65c2a
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.psi.impl.source.resolve.graphInference;
|
||||
|
||||
import com.intellij.core.JavaPsiBundle;
|
||||
@@ -276,6 +276,7 @@ public class InferenceSession {
|
||||
}
|
||||
|
||||
private static boolean isTypeParameterType(PsiTypeParameterListOwner method, PsiType paramType) {
|
||||
if (paramType instanceof PsiWildcardType) return isTypeParameterType(method, ((PsiWildcardType)paramType).getBound());
|
||||
final PsiClass psiClass = PsiUtil.resolveClassInType(paramType); //accept ellipsis here
|
||||
if (psiClass instanceof PsiTypeParameter && ((PsiTypeParameter)psiClass).getOwner() == method) return true;
|
||||
return false;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
class MyTest {
|
||||
|
||||
public static <W> void m(Class<W> targetType, Supplier<InputStream> upstream) {
|
||||
Supplier<Supplier<W>> downstream = mapping(
|
||||
(InputStream is) -> () -> readValue(is, targetType));
|
||||
}
|
||||
|
||||
public static <T,U> Supplier<U> mapping(Function<? super T, ? extends U> mapper) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <W> W readValue(InputStream stream, Class<W> targetType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.java.codeInsight.daemon.lambda;
|
||||
|
||||
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
|
||||
@@ -170,6 +156,7 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testValidFixesOnUnresolvedMethod() { doTest(); }
|
||||
public void testPolyExpressionInVoidCompatibleLambdaReturn() { doTest(); }
|
||||
public void testStopAtTypeCastWhenSearchForTopMostNode() { doTest(); }
|
||||
public void testLambdaWithExplicitTypeAndTargetTypeParameter() { doTest(); }
|
||||
|
||||
private void doTest() {
|
||||
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
|
||||
|
||||
Reference in New Issue
Block a user