[249] Incorrect identification of a specific error

R

  1. is highlighting the following as an error, even though it compiles ok...


public class MyClass1
{
public virtual object Copy()
{
return this.MemberwiseClone();
}
}

public class MyClass2 : MyClass1
{
public new virtual MyClass1 Copy()
{
return (MyClass1)this.MemberwiseClone();
}
}

public class MyClass3 : MyClass2
{
bool m_Copied = false;

public override MyClass1 Copy() // <-- ERROR: cannot change return type when overriding method
{
m_Copied = true;
return (MyClass2)this.MemberwiseClone();
}
}

2 comments
Comment actions Permalink

Thank you for the feedback.
This issue will be fixed shortly

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Joe Jax" <jj@nowhere.com> wrote in message news:e5i3ps$g9i$1@is.intellij.net...
R# is highlighting the following as an error, even though it compiles ok...

public class MyClass1
{
public virtual object Copy()
{
return this.MemberwiseClone();
}
}

public class MyClass2 : MyClass1
{
public new virtual MyClass1 Copy()
{
return (MyClass1)this.MemberwiseClone();
}
}

public class MyClass3 : MyClass2
{
bool m_Copied = false;

public override MyClass1 Copy() // <-- ERROR: cannot change return type when overriding method
{
m_Copied = true;
return (MyClass2)this.MemberwiseClone();
}
}

0
Comment actions Permalink

Cannot reproduce this problem

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Joe Jax" <jj@nowhere.com> wrote in message news:e5i3ps$g9i$1@is.intellij.net...
R# is highlighting the following as an error, even though it compiles ok...

public class MyClass1
{
public virtual object Copy()
{
return this.MemberwiseClone();
}
}

public class MyClass2 : MyClass1
{
public new virtual MyClass1 Copy()
{
return (MyClass1)this.MemberwiseClone();
}
}

public class MyClass3 : MyClass2
{
bool m_Copied = false;

public override MyClass1 Copy() // <-- ERROR: cannot change return type when overriding method
{
m_Copied = true;
return (MyClass2)this.MemberwiseClone();
}
}

0

Please sign in to leave a comment.