Issue Details (XML | Word | Printable)

Key: BOO-1133
Type: New Feature New Feature
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Cedric Vivier
Reporter: Cedric Vivier
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Boo

WARNING: Variable 'X' has the same name as a field of base type 'T'. Did you mean to use the field ?

Created: 23/Jan/09 10:53 AM   Updated: 23/Jan/09 02:09 PM   Resolved: 23/Jan/09 02:09 PM
Return to search
Component/s: Compiler
Affects Version/s: 0.8.2
Fix Version/s: 0.9

Time Tracking:
Not Specified

Issue Links:
dependent
 

Testcase included: yes


 Description  « Hide

For implicitely declared variables/locals only.

Testcase:

"""
BCW0025-1.boo(33,9): BCW0025: WARNING: Variable 'i' has the same name as a private field of base type 'Base'. Did you mean to use the field?
BCW0025-1.boo(37,9): BCW0025: WARNING: Variable 'k' has the same name as a private field of base type 'BaseBase'. Did you mean to use the field?
"""
macro enableBCW0024disableBCW0014:
	Context.Parameters.EnableWarning("BCW0025")
	Context.Parameters.DisableWarning("BCW0014") #unused privates
enableBCW0024disableBCW0014

interface IFoo:
	def Foo()

interface IBar:
	def Bar()

class BaseBase:
	private k = 2
	internal o = "o"

class Base(BaseBase,IBar):
	private i = 0
	private j = 1
	n = 1

	virtual def Foo():
		print i

	virtual def Bar():
		pass

class E(Base,IFoo):
	def Foo():
		i = 42 #!
		print i

	def Bar():
		k = 0 #!
		print k

	def Baz():
		n = 84
		o = "O"


Cedric Vivier made changes - 23/Jan/09 11:04 AM
Field Original Value New Value
Priority Major [ 3 ] Minor [ 4 ]
Assignee Cedric Vivier [ cedricv ]
Testcase included yes
Description Strict mode warning (or default mode?)

{code}
"""
BCW0025: WARNING: Variable 'i' has the same name as a field of type 'Base'. Did you mean to use the field ?
"""
class Base:
private i = 0

virtual def foo():
print i

class E(Base):
def foo():
i = 42 #!
print i
{code}

This should warn that 'i' in E.foo() is a variable and not Base.i field.
Affects Version/s 0.8.2 [ 13814 ]
Fix Version/s 0.9 [ 13816 ]
Component/s Compiler [ 10940 ]
Summary WARNING: Variable has the same name as field X of type T. WARNING: Variable 'X' has the same name as a field of type 'T'. Did you mean to use the field ?
Cedric Vivier made changes - 23/Jan/09 11:06 AM
Link This issue is depended upon by BOO-1115 [ BOO-1115 ]
Cedric Vivier made changes - 23/Jan/09 11:06 AM
Description Strict mode warning (or default mode?)

{code}
"""
BCW0025: WARNING: Variable 'i' has the same name as a field of type 'Base'. Did you mean to use the field ?
"""
class Base:
private i = 0

virtual def foo():
print i

class E(Base):
def foo():
i = 42 #!
print i
{code}

This should warn that 'i' in E.foo() is a variable and not Base.i field.
Strict mode warning (or default mode?)

{code}
"""
BCW0025: WARNING: Variable 'i' has the same name as a field of base type 'Base'. Did you mean to use the field ?
"""
class Base:
private i = 0

virtual def foo():
print i

class E(Base):
def foo():
i = 42 #!
print i
{code}

This should warn that 'i' in E.foo() is a variable and not Base.i field.
Summary WARNING: Variable 'X' has the same name as a field of type 'T'. Did you mean to use the field ? WARNING: Variable 'X' has the same name as a field of base type 'T'. Did you mean to use the field ?
Cedric Vivier made changes - 23/Jan/09 12:24 PM
Description Strict mode warning (or default mode?)

{code}
"""
BCW0025: WARNING: Variable 'i' has the same name as a field of base type 'Base'. Did you mean to use the field ?
"""
class Base:
private i = 0

virtual def foo():
print i

class E(Base):
def foo():
i = 42 #!
print i
{code}

This should warn that 'i' in E.foo() is a variable and not Base.i field.
Strict mode warning (or default mode?)

Testcase:
{code}
"""
BCW0025-1.boo(31,9): BCW0025: WARNING: Variable 'i' has the same name as a private field of base type 'Base'. Did you mean to use the field?
BCW0025-1.boo(35,9): BCW0025: WARNING: Variable 'k' has the same name as a private field of base type 'BaseBase'. Did you mean to use the field?
"""
macro enableBCW0024disableBCW0014:
Context.Parameters.EnableWarning("BCW0025")
Context.Parameters.DisableWarning("BCW0014") #unused privates
enableBCW0024disableBCW0014

interface IFoo:
def Foo()

interface IBar:
def Bar()

class BaseBase:
private k = 2

class Base(BaseBase,IBar):
private i = 0
private j = 1

virtual def Foo():
print i

virtual def Bar():
pass

class E(Base,IFoo):
def Foo():
i = 42 #!
print i

def Bar():
k = 0
print k
{code}
Cedric Vivier made changes - 23/Jan/09 12:26 PM
Description Strict mode warning (or default mode?)

Testcase:
{code}
"""
BCW0025-1.boo(31,9): BCW0025: WARNING: Variable 'i' has the same name as a private field of base type 'Base'. Did you mean to use the field?
BCW0025-1.boo(35,9): BCW0025: WARNING: Variable 'k' has the same name as a private field of base type 'BaseBase'. Did you mean to use the field?
"""
macro enableBCW0024disableBCW0014:
Context.Parameters.EnableWarning("BCW0025")
Context.Parameters.DisableWarning("BCW0014") #unused privates
enableBCW0024disableBCW0014

interface IFoo:
def Foo()

interface IBar:
def Bar()

class BaseBase:
private k = 2

class Base(BaseBase,IBar):
private i = 0
private j = 1

virtual def Foo():
print i

virtual def Bar():
pass

class E(Base,IFoo):
def Foo():
i = 42 #!
print i

def Bar():
k = 0
print k
{code}
Strict mode warning (or default mode?)

Testcase:
{code}
"""
BCW0025-1.boo(33,9): BCW0025: WARNING: Variable 'i' has the same name as a private field of base type 'Base'. Did you mean to use the field?
BCW0025-1.boo(37,9): BCW0025: WARNING: Variable 'k' has the same name as a private field of base type 'BaseBase'. Did you mean to use the field?
"""
macro enableBCW0024disableBCW0014:
Context.Parameters.EnableWarning("BCW0025")
Context.Parameters.DisableWarning("BCW0014") #unused privates
enableBCW0024disableBCW0014

interface IFoo:
def Foo()

interface IBar:
def Bar()

class BaseBase:
private k = 2
internal o = "o"

class Base(BaseBase,IBar):
private i = 0
private j = 1
n = 1

virtual def Foo():
print i

virtual def Bar():
pass

class E(Base,IFoo):
def Foo():
i = 42 #!
print i

def Bar():
k = 0 #!
print k

def Baz():
n = 84
o = "O"
{code}
Cedric Vivier made changes - 23/Jan/09 12:33 PM
Description Strict mode warning (or default mode?)

Testcase:
{code}
"""
BCW0025-1.boo(33,9): BCW0025: WARNING: Variable 'i' has the same name as a private field of base type 'Base'. Did you mean to use the field?
BCW0025-1.boo(37,9): BCW0025: WARNING: Variable 'k' has the same name as a private field of base type 'BaseBase'. Did you mean to use the field?
"""
macro enableBCW0024disableBCW0014:
Context.Parameters.EnableWarning("BCW0025")
Context.Parameters.DisableWarning("BCW0014") #unused privates
enableBCW0024disableBCW0014

interface IFoo:
def Foo()

interface IBar:
def Bar()

class BaseBase:
private k = 2
internal o = "o"

class Base(BaseBase,IBar):
private i = 0
private j = 1
n = 1

virtual def Foo():
print i

virtual def Bar():
pass

class E(Base,IFoo):
def Foo():
i = 42 #!
print i

def Bar():
k = 0 #!
print k

def Baz():
n = 84
o = "O"
{code}
For implicitely declared variables/locals only.

Testcase:
{code}
"""
BCW0025-1.boo(33,9): BCW0025: WARNING: Variable 'i' has the same name as a private field of base type 'Base'. Did you mean to use the field?
BCW0025-1.boo(37,9): BCW0025: WARNING: Variable 'k' has the same name as a private field of base type 'BaseBase'. Did you mean to use the field?
"""
macro enableBCW0024disableBCW0014:
Context.Parameters.EnableWarning("BCW0025")
Context.Parameters.DisableWarning("BCW0014") #unused privates
enableBCW0024disableBCW0014

interface IFoo:
def Foo()

interface IBar:
def Bar()

class BaseBase:
private k = 2
internal o = "o"

class Base(BaseBase,IBar):
private i = 0
private j = 1
n = 1

virtual def Foo():
print i

virtual def Bar():
pass

class E(Base,IFoo):
def Foo():
i = 42 #!
print i

def Bar():
k = 0 #!
print k

def Baz():
n = 84
o = "O"
{code}
Cedric Vivier added a comment - 23/Jan/09 02:09 PM

Landed in rev. 3183


Cedric Vivier made changes - 23/Jan/09 02:09 PM
Resolution Fixed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]