|
39 | 39 | import com.intellij.psi.stubs.StubIndex; |
40 | 40 | import com.intellij.psi.util.PsiTreeUtil; |
41 | 41 | import com.intellij.util.Function; |
| 42 | +import com.intellij.util.ObjectUtils; |
42 | 43 | import com.intellij.util.containers.ContainerUtil; |
43 | 44 | import com.intellij.xml.util.XmlStringUtil; |
44 | 45 | import org.jetbrains.annotations.NotNull; |
@@ -222,7 +223,10 @@ else if (type instanceof GoArrayOrSliceType) { |
222 | 223 | return replaceInnerTypes(type, contextImportPath, ((GoArrayOrSliceType)type).getType()); |
223 | 224 | } |
224 | 225 | else if (type instanceof GoPointerType) { |
225 | | - return replaceInnerTypes(type, contextImportPath, ((GoPointerType)type).getType()); |
| 226 | + GoType inner = ((GoPointerType)type).getType(); |
| 227 | + return inner instanceof GoSpecType |
| 228 | + ? getTypePresentation(inner, contextImportPath) |
| 229 | + : replaceInnerTypes(type, contextImportPath, inner); |
226 | 230 | } |
227 | 231 | else if (type instanceof GoTypeList) { |
228 | 232 | return "(" + replaceInnerTypes(type, contextImportPath, ((GoTypeList)type).getTypeList()) + ")"; |
@@ -273,7 +277,7 @@ private static String replaceInnerTypes(@NotNull GoType type, @Nullable String c |
273 | 277 | private static String replaceInnerTypes(@NotNull GoType type, @Nullable String contextImportPath, @NotNull List<GoType> innerTypes) { |
274 | 278 | StringBuilder result = new StringBuilder(); |
275 | 279 | String typeText = type.getText(); |
276 | | - int initialOffset = type.getTextRange().getStartOffset(); |
| 280 | + int initialOffset = ObjectUtils.notNull(type.getTextRange(), TextRange.EMPTY_RANGE).getStartOffset(); |
277 | 281 | int lastStartOffset = type.getTextLength(); |
278 | 282 | ContainerUtil.sort(innerTypes, ELEMENT_BY_RANGE_COMPARATOR); |
279 | 283 | for (int i = innerTypes.size() - 1; i >= 0; i--) { |
|
0 commit comments