[Mono-bugs] [Bug 346554] New: compiler doesnt compile a valid generics class
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Thu Dec 6 10:59:04 EST 2007
https://bugzilla.novell.com/show_bug.cgi?id=346554
Summary: compiler doesnt compile a valid generics class
Product: Mono: Runtime
Version: 1.2.6
Platform: Other
OS/Version: RHEL 5
Status: NEW
Severity: Blocker
Priority: P5 - None
Component: generics
AssignedTo: mono-bugs at ximian.com
ReportedBy: srfcanada at hotmail.com
QAContact: mono-bugs at ximian.com
Found By: ---
mono compiler given an error compiling a generics method call that is valid and
works under windows. this is the call that its failing to compile(it seems to
relate to accessing enums in a Generics class):
Statement:
Assert.IsFalse(myCol.CheckMonotonicityFromRawValue(6*60*60*24, 2,
Column<double>.ValueInsertOrSubstitute.Substitute));
Error:
/mnt/hgfs/DRMS/DRMSCurrent/lib/mono/Debug/Drms.Core.dll (Location of the symbol
related to previous error)
/mnt/hgfs/DRMS/DRMSCurrent/src/Drms.Core.Test/DomainObjects/DataContainers/ColumnTests.cs(1094,19):
error CS1503: Argument 3: Cannot convert type
`Drms.Core.DomainObjects.DataContainers.Column<T>.ValueInsertOrSubstitute' to
`Drms.Core.DomainObjects.DataContainers.Column<double>.ValueInsertOrSubstitute'
This is the nippet of the classes that its using:
public class Column<T> : Container, IEnumerable<Variable<T>>
where T : IComparable<T>
{
public enum ValueInsertOrSubstitute
{
/// <summary>
/// Inserts the value in the column.
/// </summary>
Insert,
/// <summary>
/// Substitutes the value in the column.
/// </summary>
Substitute,
}
}
public class Column<T> : Container, IEnumerable<Variable<T>>
where T : IComparable<T>
{
/// <summary>
/// Checks if a given raw value to be inserted or substituted in the
column respects its monotonicity.
/// </summary>
/// <param name="value">The value to be inserted or substituted</param>
/// <param name="pos">Position where the value will be inserted or
substituted</param>
/// <param name="insOrSubs">
/// Defines whether the value is to be inserted or substituted at the
given position.
/// </param>
/// <returns>True when the value respects the monotonicity for the
column. False, otherwise.</returns>
public bool CheckMonotonicityFromRawValue(T value, int pos,
ValueInsertOrSubstitute insOrSubs)
{
bool isOK = true;
switch (insOrSubs)
{
case ValueInsertOrSubstitute.Insert:
{
if (pos < 0 || pos > m_data.Size)
{
throw new Exception("Index is out of range for inserting
in the column");
}
if (pos < m_data.Size)
{
T highValue = m_data[pos];
isOK = ((ColumnDefinition<T>)
Definition).CheckMonotonicity(value, highValue);
}
}
break;
case ValueInsertOrSubstitute.Substitute:
{
if (pos < 0 || pos >= m_data.Size)
{
throw new Exception("Index is out of range for
substituting in the column");
}
if (pos < m_data.Size - 1)
{
T highValue = m_data[pos + 1];
isOK = ((ColumnDefinition<T>)
Definition).CheckMonotonicity(value, highValue);
}
}
break;
}
if (pos > 0)
{
T lowValue = m_data[pos - 1];
isOK = ((ColumnDefinition<T>)
Definition).CheckMonotonicity(lowValue, value) && isOK;
}
return isOK;
}
}
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list