[Mono-bugs] [Bug 684600] New: error CS1503: Argument `#2' cannot convert `<fake$type>' expression

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Apr 1 14:20:22 EDT 2011


https://bugzilla.novell.com/show_bug.cgi?id=684600

https://bugzilla.novell.com/show_bug.cgi?id=684600#c0


           Summary: error CS1503: Argument `#2' cannot convert
                    `<fake$type>' expression
    Classification: Mono
           Product: Mono: Compilers
           Version: SVN
          Platform: 64bit
        OS/Version: RHEL 5
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: msafar at novell.com
        ReportedBy: srfcanada at hotmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=422826)
 --> (http://bugzilla.novell.com/attachment.cgi?id=422826)
sample

User-Agent:       Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; WOW64;
Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; MS-RTC LM 8)

Since the patch
https://github.com/mono/mono/commit/1ec408a4656db22bbc2e2c7ce4949d6d7e666b9a
was applied Im now getting the following errors :

is never used
Server/DomainModel/Subsurface.Test/SurroundingInterfacesTest.cs(1321,96): error
CS0154: The property or indexer
`Drms.Server.DomainModel.Subsurface.DiscretizedDynamicModel.Partition' cannot
be used in this context because it lacks the `get' accessor               
/net/129.2.10.148/export/Projects/DRMSPROD/Thirdparty/mono/Debug/Drms.Server.DomainModel.Subsurface.dll
(Location of the symbol related to previous error)
Server/DomainModel/Subsurface.Test/SurroundingInterfacesTest.cs(1321,45): error
CS1502: The best overloaded method match for
`Drms.Server.DomainModel.DataContainers.RangeIterator.RangeIterator(Drms.Server.DomainModel.DataContainers.ArrayShape,
Drms.Server.DomainModel.DataContainers.IPartition)' has some invalid arguments  
/net/129.2.10.148/export/Projects/DRMSPROD/Thirdparty/mono/Debug/Drms.Server.DomainModel.DataContainers.dll
(Location of the symbol related to previous error)
Server/DomainModel/Subsurface.Test/SurroundingInterfacesTest.cs(1321,45): error
CS1503: Argument `#2' cannot convert `<fake$type>' expression to type
`Drms.Server.DomainModel.DataContainers.IPartition'                             
Server/DomainModel/Subsurface.Test/SurroundingInterfacesTest.cs(1326,59): error
CS0154: The property or indexer
`Drms.Server.DomainModel.Subsurface.DiscretizedDynamicModel.Partition' cannot
be used in this context because it lacks the `get' accessor               
/net/129.2.10.148/export/Projects/DRMSPROD/Thirdparty/mono/Debug/Drms.Server.DomainModel.Subsurface.dll
(Location of the symbol related to previous error)
Compilation failed: 4 error(s), 12 warnings


I attached a sample that should duplicate it but it doesnt seem to. It seems
the combination of TestClassBase.Partition being virtual and TestClass being
sealed causes this error. If I remove sealed , the error doesnt happen.
Unfortunatly my sample still doesnt cause this errror but Im hoping someone
could have some insight.

I debugged it further and found the change to ReadMethodModifiers is what what
causing the problem and specifically this change:

      // It can be sealed and override 
1175   -      if ((ma & MethodAttributes.Virtual) != 0) { 
1176   -        if ((ma & MethodAttributes.NewSlot) != 0 ||
!declaringType.IsClass) { 
1177   -          // No private virtual or sealed virtual 
1178   -          if ((mod & (Modifiers.PRIVATE | Modifiers.SEALED)) == 0) 
  1185 +      if ((ma & MethodAttributes.Virtual) != 0 &&
!declaringType.IsSealed) { 
  1186 +        // Not every member can be detected based on MethodAttribute,
we 
  1187 +        // set virtual or non-virtual only when we are certain. Further
checks 
  1188 +        // to really find out what `virtual' means for this member are
done 
  1189 +        // later 
  1190 +        if ((ma & MethodAttributes.NewSlot) != 0) { 
  1191 +          if ((mod & Modifiers.SEALED) != 0) { 
  1192 +            mod &= ~Modifiers.SEALED; 
  1193 +          } else { 
1179 1194              mod |= Modifiers.VIRTUAL; 
  1195 +          } 
1180 1196          } else { 
1181 1197            mod |= Modifiers.OVERRIDE; 
1182 1198          } 

Whats confusing me is why the added check for IsSealed put in since that seems
to be triggering the situation im in given the method is virtual and the base
class type is sealed which would mean it would never get into the method but
before the change I think it would. Given my sample shouldnt it go into the
method and mark the Mod to Virtual? 

I cant debug into the compiler so I cant give any more information and so far I
cant give a sample but hopfully someone could give more insight into this
change given if I revert it my errors go away. Note that windows gives no
errors(which it shouldnt since it is valid). It seems to be ending up losing
the fact that the getter is in the base class.

thanks.

scott

Reproducible: Always

Steps to Reproduce:
1.
2.
3.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list