RS can't see redundant qualifier with "named" aliases, bug?

Bug or by design? When using alias IORef the System in Bar method isn't treated as redundant, but using alias named  IO will.

using IORef = System.IO;
//Uncomment this line and RS will indicate "Qualifier is Redundant" for System qualifier.
//using IO = System.IO;

namespace FooNS
{
class Foo
{
void Bar()
{
//System below is not marked as redundant with IORef alias
new System.IO.StreamReader("foo");
}
}
}


Thanks.

2 comments
Comment actions Permalink

Hello,

When you're using 'IO = System.IO' alias, ReSharper can remove 'System' qualifier
from 'Bar' because it won't break compilation:

new IO.StreamReader("foo"); //Here IO resolves into System.IO because you
have 'IO=System.IO' alias

On the other hand, if you'll go with 'IORef = System.IO' alias, ReSharper
cannot safely remove 'System' qualifier because it will break compilation:

new IO.StreamReader("foo"); //Doesn't compile because the compiler doesn't
know what's IO now

new IORef.StreamReader("foo"); //Compiles fine

Let me know if this helps. Thank you!

Andrey Serebryansky
Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

Bug or by design? When using alias IORef the System in Bar method
isn't treated as redundant, but using alias named  IO will.

using IORef = System.IO;
//Uncomment this line and RS will indicate "Qualifier is Redundant"
for System qualifier.
//using IO = System.IO;
namespace FooNS
{
class Foo
{
void Bar()
{
//System below is not marked as redundant with IORef alias
new System.IO.StreamReader("foo");
}
}
}
Thanks.

---
Original message URL:
http://devnet.jetbrains.net/message/5267043#5267043



0
Comment actions Permalink

Ah off course. Thanks.

( I guess my "quickfix need" instead could be a feature request so I added a comment for it in existing issue
http://youtrack.jetbrains.net/issue/RSRP-42386 "Introduce namespace alias refactoring". )

0

Please sign in to leave a comment.