Boo

Invalid IL generated when ctor calls an instance method before self() or super()

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 0.8.2, 0.9
  • Fix Version/s: 0.9
  • Component/s: Compiler
  • Labels:
    None
  • Testcase included:
    yes
  • Number of attachments :
    0

Description

Currently we generate invalid IL when one calls an instance method on the object being constructed before a explicit self()/super() call :

class Test:
	def constructor():
		pass

	def constructor(x as int):
		CallBeforeSelfOrSuper() #invalid IL "uninitialized `this`" 
		self()

	def CallBeforeSelfOrSuper():
		print "before"

ECMA-335 partition III section 1.8.1.4 states :
No operations can be performed on an uninitialized this except for storing into and loading from the object's fields.

I'm not sure how we could make this work other than emitting an error when there is such a call ?

Activity

Hide
Cedric Vivier added a comment -

fixed in rev. 2991

Show
Cedric Vivier added a comment - fixed in rev. 2991

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: