[nem-bug] [Nemerle 0000721]: Unable to pass literal to parameters of type short in Attributes

feedback at nemerle.org feedback at nemerle.org
Sat Jul 29 06:19:06 CEST 2006


The following issue has been SUBMITTED.
======================================================================
<http://nemerle.org/bugs/view.php?id=721> 
======================================================================
Reported By:                askutt
Assigned To:                
======================================================================
Project:                    Nemerle
Issue ID:                   721
Category:                   Compiler (type engine)
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
======================================================================
Date Submitted:             07-29-2006 06:19 CEST
Last Modified:              07-29-2006 06:19 CEST
======================================================================
Summary:                    Unable to pass literal to parameters of type short
in Attributes
Description: 
This is really simple.  Attempt to pass a literal value to a parameter of
type short in any attribute will fail, because Nemerle treats all literals
as int by default:

using System;
using System.Runtime.InteropServices;

class Test {
    [DllImport("kernel32")]
    static extern ReadFile(handle : IntPtr,
                           [MarshalAs(UnmanagedType.LPArray,
SizeParamIndex=3)]
                           data : array[byte],
                           bytesToRead : uint,
                           bytesRead : out uint,
                           overlapped : IntPtr) : bool;
}
Compiling this yields:
test.n:6:19:11:55: error: the member `SizeParamIndex' has type
System.Int16 while the value assigned has type int

Appending 's' to the literal to coerce it to type short fails as well,
yielding:
test.n:6:19:11:55: error: complex expressions are not allowed in
attributes: (3 : short)

This is related to 0000596, I suppose.
======================================================================

Issue History
Date Modified  Username       Field                    Change              
======================================================================
07-29-06 06:19 askutt         New Issue                                    
======================================================================




More information about the bugs mailing list