Use class name as secondary constructor name

This commit is contained in:
Alexey Sedunov
2015-03-18 00:19:41 +03:00
parent c0c1273388
commit 7d278f2f42
11 changed files with 28 additions and 28 deletions
@@ -116,7 +116,7 @@ public class JetSecondaryConstructor extends JetDeclarationStub<KotlinPlaceHolde
@Override @Override
@NotNull @NotNull
public String getName() { public String getName() {
return "<init>"; return getClassOrObject().getName();
} }
@Nullable @Nullable
@@ -146,7 +146,7 @@ public class JetSecondaryConstructor extends JetDeclarationStub<KotlinPlaceHolde
@NotNull @NotNull
@Override @Override
public Name getNameAsSafeName() { public Name getNameAsSafeName() {
return Name.special(getName()); return Name.identifier(getName());
} }
@Nullable @Nullable
@@ -57,7 +57,7 @@ error:
sink: sink:
<SINK> PREV:[<ERROR>, <END>] <SINK> PREV:[<ERROR>, <END>]
===================== =====================
== <init> == == A ==
constructor(): this('a') { constructor(): this('a') {
y = 2 y = 2
} }
@@ -78,7 +78,7 @@ error:
sink: sink:
<SINK> PREV:[<ERROR>, <END>] <SINK> PREV:[<ERROR>, <END>]
===================== =====================
== <init> == == A ==
constructor(a: Int, b: Int = 3): this(b.toChar()) { constructor(a: Int, b: Int = 3): this(b.toChar()) {
y = x y = x
} }
@@ -40,7 +40,7 @@ z = 8 !<v8>: *
y = 9 !<v11>: * y = 9 !<v11>: *
{ y = 9 } !<v11>: * COPY { y = 9 } !<v11>: * COPY
===================== =====================
== <init> == == A ==
constructor(): this('a') { constructor(): this('a') {
y = 2 y = 2
} }
@@ -52,7 +52,7 @@ this('a') <v1>: * NEW: call(this('a'), <init>|<v0>) -> <v1>
y = 2 !<v4>: * y = 2 !<v4>: *
{ y = 2 } !<v4>: * COPY { y = 2 } !<v4>: * COPY
===================== =====================
== <init> == == A ==
constructor(a: Int, b: Int = 3): this(b.toChar()) { constructor(a: Int, b: Int = 3): this(b.toChar()) {
y = x y = x
} }
@@ -88,7 +88,7 @@ error:
sink: sink:
<SINK> PREV:[<ERROR>, <END>] <SINK> PREV:[<ERROR>, <END>]
===================== =====================
== <init> == == A ==
constructor(): this('a') { constructor(): this('a') {
y = 2 y = 2
} }
@@ -109,7 +109,7 @@ error:
sink: sink:
<SINK> PREV:[<ERROR>, <END>] <SINK> PREV:[<ERROR>, <END>]
===================== =====================
== <init> == == A ==
constructor(a: Int, b: Int = 3): this(b.toChar()) { constructor(a: Int, b: Int = 3): this(b.toChar()) {
y = x y = x
} }
@@ -54,7 +54,7 @@ z = 8 !<v16>: *
y = 9 !<v19>: * y = 9 !<v19>: *
{ y = 9 } !<v19>: * COPY { y = 9 } !<v19>: * COPY
===================== =====================
== <init> == == A ==
constructor(): this('a') { constructor(): this('a') {
y = 2 y = 2
} }
@@ -66,7 +66,7 @@ this('a') <v1>: * NEW: call(this('a'), <init>|<v0>) -> <v1>
y = 2 !<v4>: * y = 2 !<v4>: *
{ y = 2 } !<v4>: * COPY { y = 2 } !<v4>: * COPY
===================== =====================
== <init> == == A ==
constructor(a: Int, b: Int = 3): this(b.toChar()) { constructor(a: Int, b: Int = 3): this(b.toChar()) {
y = x y = x
} }
@@ -19,7 +19,7 @@ error:
sink: sink:
<SINK> PREV:[<ERROR>, <END>] <SINK> PREV:[<ERROR>, <END>]
===================== =====================
== <init> == == A ==
constructor() { constructor() {
if (1 == 1) { if (1 == 1) {
return return
@@ -11,7 +11,7 @@ class A {
} }
--------------------- ---------------------
===================== =====================
== <init> == == A ==
constructor() { constructor() {
if (1 == 1) { if (1 == 1) {
return return
@@ -41,7 +41,7 @@ error:
sink: sink:
<SINK> PREV:[<ERROR>, <END>] <SINK> PREV:[<ERROR>, <END>]
===================== =====================
== <init> == == A ==
constructor() { constructor() {
x = 1 x = 1
y = 2 y = 2
@@ -81,7 +81,7 @@ error:
sink: sink:
<SINK> PREV:[<ERROR>, <END>] <SINK> PREV:[<ERROR>, <END>]
===================== =====================
== <init> == == A ==
constructor(a: Int, b: Int = 3) { constructor(a: Int, b: Int = 3) {
x = a x = a
y = x y = x
@@ -132,7 +132,7 @@ error:
sink: sink:
<SINK> PREV:[<ERROR>, <END>] <SINK> PREV:[<ERROR>, <END>]
===================== =====================
== <init> == == A ==
constructor(a: String, b: Int = 4): this() { constructor(a: String, b: Int = 4): this() {
y = 5 y = 5
} }
@@ -162,7 +162,7 @@ error:
sink: sink:
<SINK> PREV:[<ERROR>, <END>] <SINK> PREV:[<ERROR>, <END>]
===================== =====================
== <init> == == A ==
constructor(a: Double, b: Int = 6): this(a.toInt()) { constructor(a: Double, b: Int = 6): this(a.toInt()) {
y = 7 y = 7
} }
@@ -33,7 +33,7 @@ class A {
} }
--------------------- ---------------------
===================== =====================
== <init> == == A ==
constructor() { constructor() {
x = 1 x = 1
y = 2 y = 2
@@ -49,7 +49,7 @@ constructor() {
y = 2 !<v13>: * y = 2 !<v13>: *
{ x = 1 y = 2 } !<v13>: * COPY { x = 1 y = 2 } !<v13>: * COPY
===================== =====================
== <init> == == A ==
constructor(a: Int, b: Int = 3) { constructor(a: Int, b: Int = 3) {
x = a x = a
y = x y = x
@@ -70,7 +70,7 @@ x <v17>: Int NEW: r(x|<v16>) -> <v17>
y = x !<v18>: * y = x !<v18>: *
{ x = a y = x } !<v18>: * COPY { x = a y = x } !<v18>: * COPY
===================== =====================
== <init> == == A ==
constructor(a: String, b: Int = 4): this() { constructor(a: String, b: Int = 4): this() {
y = 5 y = 5
} }
@@ -85,7 +85,7 @@ this() <v4>: * NEW: call(this(), <init>) -> <v4>
y = 5 !<v7>: * y = 5 !<v7>: *
{ y = 5 } !<v7>: * COPY { y = 5 } !<v7>: * COPY
===================== =====================
== <init> == == A ==
constructor(a: Double, b: Int = 6): this(a.toInt()) { constructor(a: Double, b: Int = 6): this(a.toInt()) {
y = 7 y = 7
} }
@@ -56,7 +56,7 @@ error:
sink: sink:
<SINK> PREV:[<ERROR>, <END>] <SINK> PREV:[<ERROR>, <END>]
===================== =====================
== <init> == == A ==
constructor(): super(11) { constructor(): super(11) {
x = 1 x = 1
y = 2 y = 2
@@ -97,7 +97,7 @@ error:
sink: sink:
<SINK> PREV:[<ERROR>, <END>] <SINK> PREV:[<ERROR>, <END>]
===================== =====================
== <init> == == A ==
constructor(a: Int, b: Int = 3): super(b) { constructor(a: Int, b: Int = 3): super(b) {
x = a x = a
y = x y = x
@@ -149,7 +149,7 @@ error:
sink: sink:
<SINK> PREV:[<ERROR>, <END>] <SINK> PREV:[<ERROR>, <END>]
===================== =====================
== <init> == == A ==
constructor(a: String, b: Int = 4): this() { constructor(a: String, b: Int = 4): this() {
y = 5 y = 5
} }
@@ -179,7 +179,7 @@ error:
sink: sink:
<SINK> PREV:[<ERROR>, <END>] <SINK> PREV:[<ERROR>, <END>]
===================== =====================
== <init> == == A ==
constructor(a: Double, b: Int = 6): this(a.toInt()) { constructor(a: Double, b: Int = 6): this(a.toInt()) {
y = 7 y = 7
} }
@@ -38,7 +38,7 @@ class A : B {
} }
--------------------- ---------------------
===================== =====================
== <init> == == A ==
constructor(): super(11) { constructor(): super(11) {
x = 1 x = 1
y = 2 y = 2
@@ -55,7 +55,7 @@ super(11) <v1>: * NEW: call(super(11), <init>|<v0>) -> <v1>
y = 2 !<v14>: * y = 2 !<v14>: *
{ x = 1 y = 2 } !<v14>: * COPY { x = 1 y = 2 } !<v14>: * COPY
===================== =====================
== <init> == == A ==
constructor(a: Int, b: Int = 3): super(b) { constructor(a: Int, b: Int = 3): super(b) {
x = a x = a
y = x y = x
@@ -77,7 +77,7 @@ x <v18>: Int NEW: r(x|<v17>) -> <v18>
y = x !<v19>: * y = x !<v19>: *
{ x = a y = x } !<v19>: * COPY { x = a y = x } !<v19>: * COPY
===================== =====================
== <init> == == A ==
constructor(a: String, b: Int = 4): this() { constructor(a: String, b: Int = 4): this() {
y = 5 y = 5
} }
@@ -92,7 +92,7 @@ this() <v4>: * NEW: call(this(), <init>) -> <v4>
y = 5 !<v7>: * y = 5 !<v7>: *
{ y = 5 } !<v7>: * COPY { y = 5 } !<v7>: * COPY
===================== =====================
== <init> == == A ==
constructor(a: Double, b: Int = 6): this(a.toInt()) { constructor(a: Double, b: Int = 6): this(a.toInt()) {
y = 7 y = 7
} }