diff --git a/idea/src/org/jetbrains/jet/plugin/refactoring/JetNameSuggester.java b/idea/src/org/jetbrains/jet/plugin/refactoring/JetNameSuggester.java
index cbd9d59773e..a92a35c516e 100644
--- a/idea/src/org/jetbrains/jet/plugin/refactoring/JetNameSuggester.java
+++ b/idea/src/org/jetbrains/jet/plugin/refactoring/JetNameSuggester.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2010-2013 JetBrains s.r.o.
+ * Copyright 2010-2014 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.
@@ -182,7 +182,9 @@ public class JetNameSuggester {
ClassDescriptor classDescriptor = TypeUtils.getClassDescriptor(jetType);
if (classDescriptor != null) {
Name className = classDescriptor.getName();
- addCamelNames(result, className.asString(), validator);
+ if (!className.isSpecial()) {
+ addCamelNames(result, className.asString(), validator);
+ }
}
}
diff --git a/idea/testData/refactoring/nameSuggester/AnonymousObject.kt b/idea/testData/refactoring/nameSuggester/AnonymousObject.kt
new file mode 100644
index 00000000000..43da5e24d5e
--- /dev/null
+++ b/idea/testData/refactoring/nameSuggester/AnonymousObject.kt
@@ -0,0 +1,9 @@
+// KT-4813
+
+fun foo() {
+ object {}
+}
+
+/*
+value
+*/
\ No newline at end of file
diff --git a/idea/testData/refactoring/nameSuggester/AnonymousObjectWithSuper.kt b/idea/testData/refactoring/nameSuggester/AnonymousObjectWithSuper.kt
new file mode 100644
index 00000000000..cf14ec9ee4f
--- /dev/null
+++ b/idea/testData/refactoring/nameSuggester/AnonymousObjectWithSuper.kt
@@ -0,0 +1,11 @@
+// KT-4813
+
+trait A
+
+fun foo() {
+ object: A {}
+}
+
+/*
+value
+*/
\ No newline at end of file
diff --git a/idea/testData/refactoring/nameSuggester/ArrayOfObjectsType.kt b/idea/testData/refactoring/nameSuggester/ArrayOfObjectsType.kt
new file mode 100644
index 00000000000..10d0366a063
--- /dev/null
+++ b/idea/testData/refactoring/nameSuggester/ArrayOfObjectsType.kt
@@ -0,0 +1,9 @@
+fun test() = array(object {})
+
+fun foo() {
+ test()
+}
+
+/*
+test
+*/
\ No newline at end of file
diff --git a/idea/tests/org/jetbrains/jet/plugin/refactoring/nameSuggester/JetNameSuggesterTest.java b/idea/tests/org/jetbrains/jet/plugin/refactoring/nameSuggester/JetNameSuggesterTest.java
index 24e2846d0cc..2c5c5af4ea5 100644
--- a/idea/tests/org/jetbrains/jet/plugin/refactoring/nameSuggester/JetNameSuggesterTest.java
+++ b/idea/tests/org/jetbrains/jet/plugin/refactoring/nameSuggester/JetNameSuggesterTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2010-2013 JetBrains s.r.o.
+ * Copyright 2010-2014 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.
@@ -66,6 +66,18 @@ public class JetNameSuggesterTest extends LightCodeInsightFixtureTestCase {
doTest();
}
+ public void testAnonymousObject() {
+ doTest();
+ }
+
+ public void testAnonymousObjectWithSuper() {
+ doTest();
+ }
+
+ public void testArrayOfObjectsType() {
+ doTest();
+ }
+
@Override
protected void setUp() throws Exception {
super.setUp();