vb.net - Visual Studio 2010 vs. Visual Studio 2013 - Different Compiler Errors - Why? -
We can not explain this by keeping some strange things in mind. In one class we did these 2 functions:
Public Overloads Shared Function ToList (ByVal as input object, _ Optional ByVal StringSeparator as string = ",", _ Optional In the form of ByVal CharacterCasing string = "", _ as the optional ByVal StartRow integer = 0, _ OptionalVal EndRow as integer = -1) as the string ... End Sub Folk Overloads Shared Function ToList (ByVal Input As an object, _ OptionalValitStringSeparator = ",", _Validate as String Logic String as ByVal JoinStringSeparator String = ",", _ = Optional ByVal as PreFixStr String = "", _ = Optional ByVal String = "" as PostFixStr) ... End Sub < / pre> We will not get any errors if we try to compile this project in VS 2013. If we try to compile this same exact project in VAS 2010, it returns the following error (which makes sense):
Error 1 'Public Shared Overload Function Tooltip ( In the form of an object, [string aspirator string = ","], [string = ""] as CharacterCasing, [integer = 0] as the StartRow, [EndRow integer = -1]) string 'and' public Commonly shared overloads function in the form of ToList (input value of Rs. In [String = "" as [SplitStringSeparator = ","] ", [String as [JoinStringSeparator =", "], [PrefixStr as string =" ", [String =" "] as PostFixStr) String 'in the form can not overload each other because they are only different than the default values of the optional parameter
error 2' public share overload function tool (input as object, string = string = " ; "", As described in [string = "" ] [String 'and' publicly shared overloads function as ToList (as input object, [SplitStringSeparator string = " , "As in [JoinStringSeparator string =", "], [String =" "as PreFixStr], [string as [String = PostfixStr =" "]] as string 'one Can not surcharge another because they differ with the types of optional parameters Are.
Why is a good explanation of any of the different versions of VS, sometimes when opening the only solution with the same project, there are errors and sometimes it does not happen?
Looking at the compiler source code available through the reference source, I think I have another surcharge As a valid surcharge because there is a different type of default value. You can see yourself, vb \ language \ compiler \ symbols \ symboltable.cpp, BCSYM :: CompareParams () function.
// Make sure the type is being used for default, then create {ParmTypeCompareFlags & (EQ_Shape | EQ_GenericTypeParams)) {ComparisonFlags | = EQ_OptionalTypes; // In this case, do not create a difference in type size - we take care of this about difference EQ_OptionalTypes ParmTypeCompareFlags & amp; = ~ (EQ_Shape | EQ_GenericTypeParams); // & lt; == here} Closing EQ_Shape is a bug, which indicates that the parameter is different. I can not compare that version to the way it was done in VS-2010, this version is not available.
This definitely does not make sense. And it violates chapter 4.1.1 of the language specification, which says:
A method with optional parameters is considered as many signatures, for each set of a parameter that is called by the caller Can be passed. For example, there are three corresponding signatures in the following method:
subf (short as x, _ as integer alternative = 10, _ = optional z as long = 20) < / P>
These are the signature of the law:
รข? ¢ F (Small)
A? ¢ F (Small, Integer)
A? ¢ F (Small, Integer, Long)
So I think you found a bug. It's light, the call gets resolved on the site anyway, you get the BC 30521 error You will find, "Overload resolution failed" you can report it on the connect. Microsoft.com
Comments
Post a Comment