Issue Details (XML | Word | Printable)

Key: BOO-1086
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Rodrigo B. de Oliveira
Reporter: Mike Krell
Votes: 0
Watchers: 1
Operations

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

Compilation error with generator function with exception handling

Created: 12/Oct/08 06:55 PM   Updated: 14/Jan/09 06:49 AM   Resolved: 14/Jan/09 06:49 AM
Return to search
Component/s: None
Affects Version/s: 0.8.2
Fix Version/s: 0.9

Time Tracking:
Not Specified

File Attachments: 1. Text File BOO-1086.patch (0.8 kB)


Patch Submitted: Yes


 Description  « Hide

import System.Collections.Generic

def foo() as IEnumerator[of int]:
try:
print "test"
except e:
print "An exception occurred"
return

for i in range(5):
yield i

foo()

Boo Compiler version 0.8.2.2960 (CLR v2.0.50727.1433)
bug1.boo(6,3): BCE0055: Internal compiler error: Value cannot be null.
Parameter name: local.
1 error(s).



Cedric Vivier added a comment - 13/Oct/08 10:20 PM

As posted on the list :

The attached patch fixes the problem.
For some reason, when the method is a generator (contains yield
statements), the 'local' used as the exception handler is not visited
and thus does not have a LocalBuilder handy.

I'm not commiting it yet since it is more a workaround hack than a
solution to the actual problem (the node not being visited), but well
have not much time to do it now and debugging a visitor pattern by
omission (code not run) is quite time-consuming :s


Cedric Vivier made changes - 13/Oct/08 10:20 PM
Field Original Value New Value
Attachment BOO-1086.patch [ 37514 ]
Cedric Vivier added a comment - 08/Nov/08 06:14 AM

Marking it blocker just so not to forget to check in above patch if the issue is still not properly fixed in time for 0.9 release.


Cedric Vivier made changes - 08/Nov/08 06:14 AM
Priority Major [ 3 ] Blocker [ 1 ]
Fix Version/s 0.9 [ 13816 ]
Patch Submitted [Yes]
Rodrigo B. de Oliveira made changes - 14/Jan/09 06:28 AM
Assignee Rodrigo B. de Oliveira [ bamboo ]
Rodrigo B. de Oliveira added a comment - 14/Jan/09 06:29 AM

GeneratorMethodProcessor transforms every local variable into a field of the IEnumerator implementation. This is clearly wrong for exception variables because their scope never outlives a single method invocation.


Rodrigo B. de Oliveira added a comment - 14/Jan/09 06:49 AM

Fixed in rev. 3101.


Rodrigo B. de Oliveira made changes - 14/Jan/09 06:49 AM
Resolution Fixed [ 1 ]
Status Open [ 1 ] Closed [ 6 ]