Issue Details (XML | Word | Printable)

Key: BOO-1078
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Cedric Vivier
Reporter: Sami Kyöstilä
Votes: 0
Watchers: 0
Operations

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

Cannot use enumerations as attribute parameters

Created: 07/Aug/08 03:23 PM   Updated: 22/Jan/09 01:34 PM   Resolved: 22/Jan/09 01:34 PM
Component/s: Emitter
Affects Version/s: 0.8.2
Fix Version/s: 0.9

Time Tracking:
Not Specified

File Attachments: 1. File attrtest.boo (0.2 kB)

Environment: Microsoft .NET 3.5

Testcase included: yes


 Description  « Hide

The following program fails with an internal compiler error:

--------------------------------------------------------------------------------

enum Colors:
ORANGE
BLACK
MAGENTA

class ColorAttribute(System.Attribute):
def constructor(c as Colors):
pass

class Foo:
[Color(Colors.ORANGE)]
public bar as int

--------------------------------------------------------------------------------

The error is as follows:

attrtest.boo(12,10): BCE0055: Internal compiler error: Type must be a type provided by the runtime.
Parameter name: enumType.

Changing the "Colors" type in the attribute constructor to a plain object is a workaround for this problem.



Cedric Vivier added a comment - 08/Aug/08 02:21 AM

Looks like it is a SRE gotcha. yay!
This works on Mono, and the crash is within SRE CustomAttributeBuilder.


Cedric Vivier added a comment - 22/Jan/09 02:05 AM - edited

edited:
the 'regression' was a typo! "def contructor" instead of "def constructor" huhu, I think we should get some warning about likely typos for constructor/destructor (after all this typo possibility does not exist in say C#)


Cedric Vivier added a comment - 22/Jan/09 01:34 PM

Fixed in rev. 3167