diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovySourceCodeNamedArgumentProvider.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovySourceCodeNamedArgumentProvider.java index 24e01bf0d62a..4134d64b0ab7 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovySourceCodeNamedArgumentProvider.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovySourceCodeNamedArgumentProvider.java @@ -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-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. package org.jetbrains.plugins.groovy.lang; import com.intellij.psi.PsiElement; @@ -41,13 +27,13 @@ public class GroovySourceCodeNamedArgumentProvider extends GroovyNamedArgumentPr @NotNull Map result) { PsiElement resolve = resolveResult.getElement(); if (resolve instanceof GrMethod) { - result.putAll(((GrMethod)resolve).getNamedParameters()); + ((GrMethod)resolve).getNamedParameters().forEach((key, value) -> result.putIfAbsent(key, value)); } else if (resolve instanceof GrField) { - result.putAll(((GrField)resolve).getNamedParameters()); + ((GrField)resolve).getNamedParameters().forEach((key, value) -> result.putIfAbsent(key, value)); } else if (resolve instanceof GrVariable) { - result.putAll(GrNamedArgumentSearchVisitor.find((GrVariable)resolve)); + GrNamedArgumentSearchVisitor.find((GrVariable)resolve).forEach((key, value) -> result.putIfAbsent(key, value)); } } } diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/Groovy25HighlightingTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/Groovy25HighlightingTest.groovy index 56be3905ed95..1f516e975169 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/Groovy25HighlightingTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/Groovy25HighlightingTest.groovy @@ -1,4 +1,4 @@ -// Copyright 2000-2018 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-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. package org.jetbrains.plugins.groovy.lang.highlighting import com.intellij.testFramework.LightProjectDescriptor @@ -107,4 +107,23 @@ def usage(CopyWith cw) { def resolved = ref.resolve() assert resolved instanceof GrField } + + void 'test IDEA-218376'() { + highlightingTest ''' +import groovy.transform.CompileStatic +import groovy.transform.NamedParam + +@CompileStatic +void namedParams(@NamedParam(value = 'last', type = Integer) Map args, int i) { + print args.last +} + +@CompileStatic +def m() { + namedParams(1, last: "1") +} + +m() +''' + } } \ No newline at end of file