Skip to content

Commit 4341957

Browse files
RobertvanderHulstcpyrgasfforay
authored
Dev (#1734)
* [Build] Add support for _Parameter2 etc in WriteCodeFragment to support Attributes from Verify * [CodeDomProvider] Add support for generating AssemblyCustomAttributes stored in the CodeCompileUnit object * [CodeDomProvider] Added some END ... lines * [Docs] Fixed typos in DBServer Filter and Deleted topics * [Docs] Updated comment in Chinese help * [Vsintegration] Resolving a field from a sourcetype can also return a System.Type. Also resolve exception when there are no entities found when finding ExtensionMethods. * [Nuget] First try to create Nuget packages for Net46 * [Nuget] Correction of the Root Folder Correction of the Root folder var * [Nuget] Added several parameters : Build, OutputFolder, ... * [NuGet] Add Script to add XSharp to Nuget.config * [VOXporter] Introduced "VXP-NOCHANGE"/"{VOXP:NOCHANGE}" source code tag to instruct VOXporter to not modify at all a (external) prg file * SQLRDD Added unit tests and made several changes * Added SQLRDD Unit Tests project * SQL RDD Beta 3 * wip * SqlRDD Fix problems with Beta 3 * [Tests] Added code to save and restore settings in the runtimestate * [Compiler] Fix and test for #1733 * [Docs] Updated doc for SQLRDD Beta 4 * [SqlRDD} Fix an update problem reported by Chris. * [Runtime tests] Added SQLRDD test for SQLite * [SqlRDD] Handle column updates where nothing was changed * [Tests] Updated SQLite Unit tests * Added missing files --------- Co-authored-by: cpyrgas <[email protected]> Co-authored-by: Fabrice Foray <[email protected]>
1 parent 5d96ab4 commit 4341957

File tree

71 files changed

+11619
-422
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+11619
-422
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,3 +244,4 @@ XSharp/src/Setup/Preprocessed.iss
244244
/src/Tools/VFPXPorter/Source/VFPXPorterLib/Data/Templates/Tools/XSharp.VFP.UI.dll
245245
*.chw
246246
/src/Compiler/src/Compiler/XSharpBuildTask/XSharp.Build.dll
247+
/Artifact/SqlRddHelp

src/Compiler/src/Compiler/XSharpCodeAnalysis/Symbols/ParameterSymbolExtensions.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,14 @@ public static BoundExpression GetVODefaultParameter(this ParameterSymbol param,
109109
// Fixes C805
110110
var value = arg.Value;
111111
var valueType = CodeAnalysis.SpecialTypeExtensions.FromRuntimeTypeOfLiteralValue(value);
112-
if (arg.Type.SpecialType != valueType)
112+
var specialType = param.Type.SpecialType;
113+
if (param.Type.IsUsualType() || param.Type.IsObjectType() || specialType == SpecialType.None)
113114
{
114-
switch (arg.Type.SpecialType)
115+
specialType = arg.Type.SpecialType;
116+
}
117+
if (specialType != valueType)
118+
{
119+
switch (specialType)
115120
{
116121
case SpecialType.System_Byte:
117122
value = Convert.ChangeType(value, typeof(byte));
@@ -137,10 +142,13 @@ public static BoundExpression GetVODefaultParameter(this ParameterSymbol param,
137142
case SpecialType.System_UInt64:
138143
value = Convert.ChangeType(value, typeof(ulong));
139144
break;
145+
case SpecialType.System_Decimal:
146+
value = Convert.ChangeType(value, typeof(decimal));
147+
break;
140148
}
141149
}
142-
constant = ConstantValue.Create(value, arg.Type.SpecialType);
143-
var netType = compilation.GetSpecialType(arg.Type.SpecialType);
150+
constant = ConstantValue.Create(value, specialType);
151+
var netType = compilation.GetSpecialType(specialType);
144152
return new BoundLiteral(syntax, constant, netType);
145153
}
146154
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
public static class Test
2+
public static method TestMethodNotWorking(a := 0 as decimal, b := 0 as decimal) as decimal
3+
return a + b
4+
5+
public static method TestMethodWorking(a := 0.0m as decimal, b := 0.0m as decimal) as decimal
6+
return a + b
7+
end class
8+
9+
function Start() as void strict
10+
var x := Test.TestMethodWorking()
11+
x := Test.TestMethodNotWorking() // crashing also in debugger with breakpoint in line before...never reached this line
12+
? x
13+
return

src/CompilerTests/Applications/RuntimeTests/Prg/RuntimeTests.prg

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ FUNCTION Start() AS INT
3131
"C836", "C837", "C840", "C846", "C847", "C848", "C849", "C850","C851","C853",;
3232
"C857", "C859", "C860", "C865", "C866", "C867", "C869", "C870","C871","C873","C874",;
3333
"C877", "C878", "C879", "C880", "C881", "C882", "C884", "C885", "C886", "C887", ;
34-
"C893", "C895", "C897", "C898", "C900", "C901", "C902", "C902b", "C903", "C904", ;
34+
"C893", "C895", "C897", "C898", "C899","C900", "C901", "C902", "C902b", "C903", "C904", ;
3535
"C905", "C908", "C913", "C914", "C915", "C921", "C926", "C932", "C936", ;
3636
;
3737
"R678", "R681", "R690", "R698", "R699", "R700" ,"R701", "R702", "R710",;
@@ -45,8 +45,7 @@ FUNCTION Start() AS INT
4545
"R875", "R876", "R878", "R879", "R883", "R884", "R885", "R886", "R888", /*"R888b",*/ "R889", ; // R888b needs /xpp1
4646
"R890", "R892", "R895", "R896", "R897", "R899", "R900", "R902", "R903", "R904", "R905", "R905b",;
4747
"R906", "R907", "R908", "R909", "R910", "R911", "R912", "R913", "R914", "R918", "R919",;
48-
"R920", "R921", "R923", "R924",;
49-
"C899"; // run last because it changes settings
48+
"R920", "R921", "R923", "R924", "R929";
5049
}
5150

5251
#ifdef GUI
@@ -118,6 +117,11 @@ FUNCTION DoTest(cExe AS STRING) AS LOGIC
118117

119118
// todo: set the correct dialect by calling
120119
oMethod := oType:GetMethod("Start",BindingFlags.IgnoreCase+BindingFlags.Static+BindingFlags.Public)
120+
var settings := RuntimeState.GetInstance():Settings
121+
var backup := Dictionary<Set, object>{}
122+
foreach var entry in settings
123+
backup:Add(entry:Key, entry:Value)
124+
next
121125
TRY
122126
IF oMethod == NULL
123127
? "Could not find Start method in assembly "+oAssembly:GetName():FullName
@@ -138,6 +142,11 @@ FUNCTION DoTest(cExe AS STRING) AS LOGIC
138142
System.Windows.Forms.MessageBox.Show(e:ToString() , "Runtime test " + cExe + " failed:")
139143
#endif
140144
END TRY
145+
settings:Clear()
146+
foreach var entry in backup
147+
settings:Add(entry:Key, entry:Value)
148+
next
149+
141150
VoDbCloseAll()
142151
RETURN lSucces
143152

src/CompilerTests/xSharp Tests.viproj

Lines changed: 127 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ RecentReference = Browse:E:\XSharp\Dev\src\CompilerTests\Runtime\XSharp.VFP.dll
3535
RecentReference = GAC:XSharp.Core,v4,2.6.0.0
3636
RecentReference = GAC:XSharp.RT,v4,2.6.0.0
3737
RecentReference = Browse:E:\XSharp\Dev30\Artifacts\Debug\VOWin32APILibrary.dll
38+
RecentReference = Browse:E:\XSharp\Dev\src\CompilerTests\Runtime\VulcanRT.dll
39+
RecentReference = Browse:E:\XSharp\Dev\src\CompilerTests\Runtime\VulcanRTFuncs.dll
3840

3941
[Application Groups]
4042
ApplicationGroup = BUGS,E440B545-3C18-4457-A54F-4F3256349ABE,723E53EA-0D2C-4FC9-B86E-F050D29A49D2
@@ -15144,8 +15146,8 @@ FileType = Code
1514415146
CopyToBin = 0
1514515147
[C161 References]
1514615148
ReferenceGAC = CLR4,System,1,0,4.0.0.0
15147-
ReferenceGAC = VulcanRT,1,0,1.1.401.0
15148-
ReferenceGAC = VulcanRTFuncs,1,0,1.1.401.0
15149+
ReferenceBrowse = E:\XSharp\Dev\src\CompilerTests\Runtime\VulcanRT.dll,1,1
15150+
ReferenceBrowse = E:\XSharp\Dev\src\CompilerTests\Runtime\VulcanRTFuncs.dll,1,1
1514915151
[C161 Resources]
1515015152
[C161 Native Resources]
1515115153
[C161 License files]
@@ -15264,8 +15266,8 @@ FileType = Code
1526415266
CopyToBin = 0
1526515267
[C162 References]
1526615268
ReferenceGAC = CLR4,System,1,0,4.0.0.0
15267-
ReferenceGAC = VulcanRT,1,0,1.1.401.0
15268-
ReferenceGAC = VulcanRTFuncs,1,0,1.1.401.0
15269+
ReferenceBrowse = E:\XSharp\Dev\src\CompilerTests\Runtime\VulcanRT.dll,1,1
15270+
ReferenceBrowse = E:\XSharp\Dev\src\CompilerTests\Runtime\VulcanRTFuncs.dll,1,1
1526915271
[C162 Resources]
1527015272
[C162 Native Resources]
1527115273
[C162 License files]
@@ -47853,9 +47855,9 @@ FileType = Code
4785347855
CopyToBin = 0
4785447856
[C398 - Problem with float default values and /vo14+ References]
4785547857
ReferenceGAC = CLR4,System,1,0,4.0.0.0
47856-
ReferenceGAC = VulcanRT,1,0,1.1.401.0
47857-
ReferenceGAC = VulcanRTFuncs,1,0,1.1.401.0
4785847858
ReferenceGAC = CLR4,mscorlib,1,0,4.0.0.0
47859+
ReferenceBrowse = E:\XSharp\Dev\src\CompilerTests\Runtime\VulcanRTFuncs.dll,1,1
47860+
ReferenceBrowse = E:\XSharp\Dev\src\CompilerTests\Runtime\VulcanRT.dll,1,1
4785947861
[C398 - Problem with float default values and /vo14+ Resources]
4786047862
[C398 - Problem with float default values and /vo14+ Native Resources]
4786147863
[C398 - Problem with float default values and /vo14+ License files]
@@ -137207,6 +137209,125 @@ AppConfig = Release,22222222-2222-2222-2222-222222222222
137207137209
ForceX86=0
137208137210
Optimize=0
137209137211
ENDApplication = C938 - Latebound assign of iVars
137212+
137213+
ApplicationGroup = 1BBEE766-1BC4-4BAE-9C98-BAEB270E8A0F
137214+
; ************** APPLICATION R929 - Parametertype does not match type of default value *************
137215+
Application = R929 - Parametertype does not match type of default value
137216+
IDEVersion = 1.06
137217+
GalleryName =
137218+
GalleryPage =
137219+
GalleryDefaultName =
137220+
Target = 0
137221+
Platform = AnyCPU
137222+
Language = XSharp
137223+
Runtime = CLR4
137224+
Dialect = Core
137225+
Folder = %ProjectPath%\Applications\R929\
137226+
PrgSubFolder = \Prg
137227+
ResourcesSubFolder = \Resources
137228+
Description = Just a simple x# application
137229+
NameSpace =
137230+
Assembly = R929
137231+
Extension =
137232+
ApplicationIcon =
137233+
OutputFolder =
137234+
Frameworks = 1
137235+
GUID = DFFE8058-9B7C-475D-B047-8B8DC432D1C1
137236+
IncludeInProjectBuild = 1
137237+
IncludeInProjectSearch = 1
137238+
IncludeInProjectExport = 1
137239+
IncludePath =
137240+
StdDefsFile =
137241+
AppToRun =
137242+
SignAssembly = 0
137243+
KeyFile =
137244+
137245+
[ExportOptions]
137246+
ExportResources = 0
137247+
ExportImages = 0
137248+
[R929 - Parametertype does not match type of default value FileGroups]
137249+
[R929 - Parametertype does not match type of default value Files]
137250+
File = %AppPath%\Prg\R929.prg
137251+
FileGUID = 54FFC7BE-F281-4B3F-9D74-AF73670B60FB
137252+
FileType = Code
137253+
CopyToBin = 0
137254+
[R929 - Parametertype does not match type of default value References]
137255+
ReferenceGAC = CLR4,System,1,0,4.0.0.0
137256+
ReferenceGAC = CLR4,System.Core,1,0,4.0.0.0
137257+
[R929 - Parametertype does not match type of default value Resources]
137258+
[R929 - Parametertype does not match type of default value Native Resources]
137259+
[R929 - Parametertype does not match type of default value License files]
137260+
[R929 - Parametertype does not match type of default value General Options]
137261+
Switches=
137262+
ZeroArrays=0
137263+
CaseSensitive=0
137264+
ImplicitNamespace=0
137265+
VO1=0
137266+
VO2=0
137267+
VO3=0
137268+
VO4=0
137269+
VO5=0
137270+
VO6=0
137271+
VO7=0
137272+
VO8=0
137273+
VO9=0
137274+
VO10=0
137275+
VO11=0
137276+
VO12=0
137277+
VO13=0
137278+
VO14=0
137279+
VO15=0
137280+
VO16=0
137281+
VO17=0
137282+
FOX1=0
137283+
FOX2=0
137284+
XPP1=0
137285+
LateBound=0
137286+
Unsafe=0
137287+
Undeclared=0
137288+
EnforceSelf=0
137289+
EnforceOverride=0
137290+
UseNativeVersion=0
137291+
MemVar=0
137292+
IgnoreStdDefs=0
137293+
Ovf=0
137294+
FOvf=0
137295+
ModernSyntax=0
137296+
NamedArgs=0
137297+
InitLocals=0
137298+
AllowOldStyleAssignments=0
137299+
AllowDotOption=1
137300+
ResponseOnly=0
137301+
[R929 - Parametertype does not match type of default value Configurations]
137302+
AppConfig = Debug,11111111-1111-1111-1111-111111111111
137303+
Switches=
137304+
SwitchesCF=
137305+
CommandLine=
137306+
CommandLineCF=
137307+
Debug=1
137308+
DebugInit=1
137309+
DefineDebug=1
137310+
DefineTrace=0
137311+
SyntaxOnly=0
137312+
WarningsErrors=1
137313+
ForceConsole=0
137314+
ForceX86=0
137315+
Optimize=0
137316+
AppConfig = Release,22222222-2222-2222-2222-222222222222
137317+
Switches=
137318+
SwitchesCF=
137319+
CommandLine=
137320+
CommandLineCF=
137321+
Debug=0
137322+
DebugInit=0
137323+
DefineDebug=0
137324+
DefineTrace=0
137325+
SyntaxOnly=0
137326+
WarningsErrors=1
137327+
ForceConsole=0
137328+
ForceX86=0
137329+
Optimize=0
137330+
ENDApplication = R929 - Parametertype does not match type of default value
137210137331
[EndApplications]
137211137332

137212137333
[Configurations]

src/Runtime.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ Project("{AA6C8D78-22FF-423A-9C7C-5F2393824E04}") = "MemoTest", "Tests\MemoTest\
200200
EndProject
201201
Project("{AA6C8D78-22FF-423A-9C7C-5F2393824E04}") = "WindowsFormsApplication5", "..\..\..\source\WindowsFormsApplication5\WindowsFormsApplication5\WindowsFormsApplication5.xsproj", "{F35D8039-27B0-4718-A109-C64A6AA3E74D}"
202202
EndProject
203+
Project("{AA6C8D78-22FF-423A-9C7C-5F2393824E04}") = "XSharp.SQLRdd.Tests", "Runtime\XSharp.SQLRdd.Tests\XSharp.SQLRdd.Tests.xsproj", "{A9AD5CA6-2B10-47D0-8B50-F5A8A998979F}"
204+
EndProject
203205
Global
204206
GlobalSection(SolutionConfigurationPlatforms) = preSolution
205207
Debug|Any CPU = Debug|Any CPU
@@ -430,6 +432,10 @@ Global
430432
{F35D8039-27B0-4718-A109-C64A6AA3E74D}.Debug|Any CPU.Build.0 = Debug|Any CPU
431433
{F35D8039-27B0-4718-A109-C64A6AA3E74D}.Release|Any CPU.ActiveCfg = Release|Any CPU
432434
{F35D8039-27B0-4718-A109-C64A6AA3E74D}.Release|Any CPU.Build.0 = Release|Any CPU
435+
{A9AD5CA6-2B10-47D0-8B50-F5A8A998979F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
436+
{A9AD5CA6-2B10-47D0-8B50-F5A8A998979F}.Debug|Any CPU.Build.0 = Debug|Any CPU
437+
{A9AD5CA6-2B10-47D0-8B50-F5A8A998979F}.Release|Any CPU.ActiveCfg = Release|Any CPU
438+
{A9AD5CA6-2B10-47D0-8B50-F5A8A998979F}.Release|Any CPU.Build.0 = Release|Any CPU
433439
EndGlobalSection
434440
GlobalSection(SolutionProperties) = preSolution
435441
HideSolutionNode = FALSE
@@ -492,6 +498,7 @@ Global
492498
{3409EF64-BB1A-47DB-AB1B-38623CF6A251} = {FBBE72BB-AF27-4F54-BB40-419574C1D018}
493499
{68A869E2-DCAB-4FDF-A460-EDA80A7FCFCB} = {FBBE72BB-AF27-4F54-BB40-419574C1D018}
494500
{F35D8039-27B0-4718-A109-C64A6AA3E74D} = {0E600EC1-23D2-48D5-8301-0F4BF1C1D250}
501+
{A9AD5CA6-2B10-47D0-8B50-F5A8A998979F} = {AAA2A7F4-2856-4404-9B77-09D7AF56DE9D}
495502
EndGlobalSection
496503
GlobalSection(ExtensibilityGlobals) = postSolution
497504
SolutionGuid = {EF30CE30-FC9E-4FC7-B9F0-DCA49411ACFC}

0 commit comments

Comments
 (0)