THRIFT-4554 uncompileable code with member names that are also types under specific conditions
Client: Delphi
Patch: Jens Geyer
This closes #1539
diff --git a/lib/delphi/DelphiThrift.groupproj b/lib/delphi/DelphiThrift.groupproj
new file mode 100644
index 0000000..a172e49
--- /dev/null
+++ b/lib/delphi/DelphiThrift.groupproj
@@ -0,0 +1,156 @@
+ <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectGuid>{6BD327A5-7688-4263-B6A8-B15207CF4EC5}</ProjectGuid>
+ </PropertyGroup>
+ <ItemGroup>
+ <Projects Include="test\client.dproj">
+ <Dependencies/>
+ </Projects>
+ <Projects Include="test\server.dproj">
+ <Dependencies/>
+ </Projects>
+ <Projects Include="test\multiplexed\Multiplex.Test.Client.dproj">
+ <Dependencies/>
+ </Projects>
+ <Projects Include="test\multiplexed\Multiplex.Test.Server.dproj">
+ <Dependencies/>
+ </Projects>
+ <Projects Include="test\serializer\TestSerializer.dproj">
+ <Dependencies/>
+ </Projects>
+ <Projects Include="test\skip\skiptest_version1.dproj">
+ <Dependencies/>
+ </Projects>
+ <Projects Include="test\skip\skiptest_version2.dproj">
+ <Dependencies/>
+ </Projects>
+ <Projects Include="test\typeregistry\TestTypeRegistry.dproj">
+ <Dependencies/>
+ </Projects>
+ <Projects Include="..\..\tutorial\delphi\DelphiServer\DelphiServer.dproj">
+ <Dependencies/>
+ </Projects>
+ <Projects Include="..\..\tutorial\delphi\DelphiClient\DelphiClient.dproj">
+ <Dependencies/>
+ </Projects>
+ <Projects Include="test\keywords\ReservedKeywords.dproj">
+ <Dependencies/>
+ </Projects>
+ </ItemGroup>
+ <ProjectExtensions>
+ <Borland.Personality>Default.Personality.12</Borland.Personality>
+ <Borland.ProjectType/>
+ <BorlandProject>
+ <Default.Personality/>
+ </BorlandProject>
+ </ProjectExtensions>
+ <Target Name="client">
+ <MSBuild Projects="test\client.dproj"/>
+ </Target>
+ <Target Name="client:Clean">
+ <MSBuild Projects="test\client.dproj" Targets="Clean"/>
+ </Target>
+ <Target Name="client:Make">
+ <MSBuild Projects="test\client.dproj" Targets="Make"/>
+ </Target>
+ <Target Name="server">
+ <MSBuild Projects="test\server.dproj"/>
+ </Target>
+ <Target Name="server:Clean">
+ <MSBuild Projects="test\server.dproj" Targets="Clean"/>
+ </Target>
+ <Target Name="server:Make">
+ <MSBuild Projects="test\server.dproj" Targets="Make"/>
+ </Target>
+ <Target Name="Multiplex_Test_Client">
+ <MSBuild Projects="test\multiplexed\Multiplex.Test.Client.dproj"/>
+ </Target>
+ <Target Name="Multiplex_Test_Client:Clean">
+ <MSBuild Projects="test\multiplexed\Multiplex.Test.Client.dproj" Targets="Clean"/>
+ </Target>
+ <Target Name="Multiplex_Test_Client:Make">
+ <MSBuild Projects="test\multiplexed\Multiplex.Test.Client.dproj" Targets="Make"/>
+ </Target>
+ <Target Name="Multiplex_Test_Server">
+ <MSBuild Projects="test\multiplexed\Multiplex.Test.Server.dproj"/>
+ </Target>
+ <Target Name="Multiplex_Test_Server:Clean">
+ <MSBuild Projects="test\multiplexed\Multiplex.Test.Server.dproj" Targets="Clean"/>
+ </Target>
+ <Target Name="Multiplex_Test_Server:Make">
+ <MSBuild Projects="test\multiplexed\Multiplex.Test.Server.dproj" Targets="Make"/>
+ </Target>
+ <Target Name="TestSerializer">
+ <MSBuild Projects="test\serializer\TestSerializer.dproj"/>
+ </Target>
+ <Target Name="TestSerializer:Clean">
+ <MSBuild Projects="test\serializer\TestSerializer.dproj" Targets="Clean"/>
+ </Target>
+ <Target Name="TestSerializer:Make">
+ <MSBuild Projects="test\serializer\TestSerializer.dproj" Targets="Make"/>
+ </Target>
+ <Target Name="skiptest_version1">
+ <MSBuild Projects="test\skip\skiptest_version1.dproj"/>
+ </Target>
+ <Target Name="skiptest_version1:Clean">
+ <MSBuild Projects="test\skip\skiptest_version1.dproj" Targets="Clean"/>
+ </Target>
+ <Target Name="skiptest_version1:Make">
+ <MSBuild Projects="test\skip\skiptest_version1.dproj" Targets="Make"/>
+ </Target>
+ <Target Name="skiptest_version2">
+ <MSBuild Projects="test\skip\skiptest_version2.dproj"/>
+ </Target>
+ <Target Name="skiptest_version2:Clean">
+ <MSBuild Projects="test\skip\skiptest_version2.dproj" Targets="Clean"/>
+ </Target>
+ <Target Name="skiptest_version2:Make">
+ <MSBuild Projects="test\skip\skiptest_version2.dproj" Targets="Make"/>
+ </Target>
+ <Target Name="TestTypeRegistry">
+ <MSBuild Projects="test\typeregistry\TestTypeRegistry.dproj"/>
+ </Target>
+ <Target Name="TestTypeRegistry:Clean">
+ <MSBuild Projects="test\typeregistry\TestTypeRegistry.dproj" Targets="Clean"/>
+ </Target>
+ <Target Name="TestTypeRegistry:Make">
+ <MSBuild Projects="test\typeregistry\TestTypeRegistry.dproj" Targets="Make"/>
+ </Target>
+ <Target Name="DelphiServer">
+ <MSBuild Projects="..\..\tutorial\delphi\DelphiServer\DelphiServer.dproj"/>
+ </Target>
+ <Target Name="DelphiServer:Clean">
+ <MSBuild Projects="..\..\tutorial\delphi\DelphiServer\DelphiServer.dproj" Targets="Clean"/>
+ </Target>
+ <Target Name="DelphiServer:Make">
+ <MSBuild Projects="..\..\tutorial\delphi\DelphiServer\DelphiServer.dproj" Targets="Make"/>
+ </Target>
+ <Target Name="DelphiClient">
+ <MSBuild Projects="..\..\tutorial\delphi\DelphiClient\DelphiClient.dproj"/>
+ </Target>
+ <Target Name="DelphiClient:Clean">
+ <MSBuild Projects="..\..\tutorial\delphi\DelphiClient\DelphiClient.dproj" Targets="Clean"/>
+ </Target>
+ <Target Name="DelphiClient:Make">
+ <MSBuild Projects="..\..\tutorial\delphi\DelphiClient\DelphiClient.dproj" Targets="Make"/>
+ </Target>
+ <Target Name="ReservedKeywords">
+ <MSBuild Projects="test\keywords\ReservedKeywords.dproj"/>
+ </Target>
+ <Target Name="ReservedKeywords:Clean">
+ <MSBuild Projects="test\keywords\ReservedKeywords.dproj" Targets="Clean"/>
+ </Target>
+ <Target Name="ReservedKeywords:Make">
+ <MSBuild Projects="test\keywords\ReservedKeywords.dproj" Targets="Make"/>
+ </Target>
+ <Target Name="Build">
+ <CallTarget Targets="client;server;Multiplex_Test_Client;Multiplex_Test_Server;TestSerializer;skiptest_version1;skiptest_version2;TestTypeRegistry;DelphiServer;DelphiClient;ReservedKeywords"/>
+ </Target>
+ <Target Name="Clean">
+ <CallTarget Targets="client:Clean;server:Clean;Multiplex_Test_Client:Clean;Multiplex_Test_Server:Clean;TestSerializer:Clean;skiptest_version1:Clean;skiptest_version2:Clean;TestTypeRegistry:Clean;DelphiServer:Clean;DelphiClient:Clean;ReservedKeywords:Clean"/>
+ </Target>
+ <Target Name="Make">
+ <CallTarget Targets="client:Make;server:Make;Multiplex_Test_Client:Make;Multiplex_Test_Server:Make;TestSerializer:Make;skiptest_version1:Make;skiptest_version2:Make;TestTypeRegistry:Make;DelphiServer:Make;DelphiClient:Make;ReservedKeywords:Make"/>
+ </Target>
+ <Import Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')" Project="$(BDS)\Bin\CodeGear.Group.Targets"/>
+ </Project>
diff --git a/lib/delphi/test/keywords/ReservedIncluded.thrift b/lib/delphi/test/keywords/ReservedIncluded.thrift
new file mode 100644
index 0000000..8b47a50
--- /dev/null
+++ b/lib/delphi/test/keywords/ReservedIncluded.thrift
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// make sure generated code does not produce name collisions with predefined keywords
+namespace delphi SysUtils
+
+const i32 integer = 42
+
+// EOF
diff --git a/lib/delphi/test/keywords/ReservedKeywords.dpr b/lib/delphi/test/keywords/ReservedKeywords.dpr
new file mode 100644
index 0000000..1fbc8c1
--- /dev/null
+++ b/lib/delphi/test/keywords/ReservedKeywords.dpr
@@ -0,0 +1,15 @@
+program ReservedKeywords;
+
+{$APPTYPE CONSOLE}
+
+uses
+ SysUtils, System_;
+
+begin
+ try
+ { TODO -oUser -cConsole Main : Code hier einfügen }
+ except
+ on E: Exception do
+ Writeln(E.ClassName, ': ', E.Message);
+ end;
+end.
diff --git a/lib/delphi/test/keywords/ReservedKeywords.dproj b/lib/delphi/test/keywords/ReservedKeywords.dproj
new file mode 100644
index 0000000..6bd9544
--- /dev/null
+++ b/lib/delphi/test/keywords/ReservedKeywords.dproj
@@ -0,0 +1,112 @@
+ <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectGuid>{F2E9B6FC-A931-4271-8E30-5A4E402481B4}</ProjectGuid>
+ <MainSource>ReservedKeywords.dpr</MainSource>
+ <ProjectVersion>12.3</ProjectVersion>
+ <Basis>True</Basis>
+ <Config Condition="'$(Config)'==''">Debug</Config>
+ <Platform>Win32</Platform>
+ <AppType>Console</AppType>
+ <FrameworkType>None</FrameworkType>
+ <DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Config)'=='Basis' or '$(Base)'!=''">
+ <Base>true</Base>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
+ <Cfg_1>true</Cfg_1>
+ <CfgParent>Base</CfgParent>
+ <Base>true</Base>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
+ <Cfg_2>true</Cfg_2>
+ <CfgParent>Base</CfgParent>
+ <Base>true</Base>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Base)'!=''">
+ <DCC_ImageBase>00400000</DCC_ImageBase>
+ <DCC_DcuOutput>.\$(Config)\$(Platform)</DCC_DcuOutput>
+ <DCC_UnitSearchPath>gen-delphi;..\..\src;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
+ <DCC_UnitAlias>WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;$(DCC_UnitAlias)</DCC_UnitAlias>
+ <DCC_ExeOutput>.\$(Config)\$(Platform)</DCC_ExeOutput>
+ <DCC_N>false</DCC_N>
+ <DCC_S>false</DCC_S>
+ <DCC_K>false</DCC_K>
+ <DCC_E>false</DCC_E>
+ <DCC_F>false</DCC_F>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Cfg_1)'!=''">
+ <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
+ <DCC_Optimize>false</DCC_Optimize>
+ <DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Cfg_2)'!=''">
+ <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
+ <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
+ <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
+ <DCC_DebugInformation>false</DCC_DebugInformation>
+ </PropertyGroup>
+ <ItemGroup>
+ <DelphiCompile Include="ReservedKeywords.dpr">
+ <MainSource>MainSource</MainSource>
+ </DelphiCompile>
+ <BuildConfiguration Include="Release">
+ <Key>Cfg_2</Key>
+ <CfgParent>Base</CfgParent>
+ </BuildConfiguration>
+ <BuildConfiguration Include="Basis">
+ <Key>Base</Key>
+ </BuildConfiguration>
+ <BuildConfiguration Include="Debug">
+ <Key>Cfg_1</Key>
+ <CfgParent>Base</CfgParent>
+ </BuildConfiguration>
+ </ItemGroup>
+ <Import Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')" Project="$(BDS)\Bin\CodeGear.Delphi.Targets"/>
+ <Import Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')" Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj"/>
+ <PropertyGroup>
+ <PreBuildEvent><![CDATA[thrift -r -gen delphi ReservedKeywords.thrift]]></PreBuildEvent>
+ </PropertyGroup>
+ <ProjectExtensions>
+ <Borland.Personality>Delphi.Personality.12</Borland.Personality>
+ <Borland.ProjectType/>
+ <BorlandProject>
+ <Delphi.Personality>
+ <VersionInfo>
+ <VersionInfo Name="IncludeVerInfo">False</VersionInfo>
+ <VersionInfo Name="AutoIncBuild">False</VersionInfo>
+ <VersionInfo Name="MajorVer">1</VersionInfo>
+ <VersionInfo Name="MinorVer">0</VersionInfo>
+ <VersionInfo Name="Release">0</VersionInfo>
+ <VersionInfo Name="Build">0</VersionInfo>
+ <VersionInfo Name="Debug">False</VersionInfo>
+ <VersionInfo Name="PreRelease">False</VersionInfo>
+ <VersionInfo Name="Special">False</VersionInfo>
+ <VersionInfo Name="Private">False</VersionInfo>
+ <VersionInfo Name="DLL">False</VersionInfo>
+ <VersionInfo Name="Locale">1031</VersionInfo>
+ <VersionInfo Name="CodePage">1252</VersionInfo>
+ </VersionInfo>
+ <VersionInfoKeys>
+ <VersionInfoKeys Name="CompanyName"/>
+ <VersionInfoKeys Name="FileDescription"/>
+ <VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
+ <VersionInfoKeys Name="InternalName"/>
+ <VersionInfoKeys Name="LegalCopyright"/>
+ <VersionInfoKeys Name="LegalTrademarks"/>
+ <VersionInfoKeys Name="OriginalFilename"/>
+ <VersionInfoKeys Name="ProductName"/>
+ <VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
+ <VersionInfoKeys Name="Comments"/>
+ </VersionInfoKeys>
+ <Source>
+ <Source Name="MainSource">ReservedKeywords.dpr</Source>
+ </Source>
+ </Delphi.Personality>
+ <Platforms>
+ <Platform value="Win32">True</Platform>
+ </Platforms>
+ </BorlandProject>
+ <ProjectFileVersion>12</ProjectFileVersion>
+ </ProjectExtensions>
+ </Project>
diff --git a/lib/delphi/test/codegen/ReservedKeywords.thrift b/lib/delphi/test/keywords/ReservedKeywords.thrift
similarity index 75%
rename from lib/delphi/test/codegen/ReservedKeywords.thrift
rename to lib/delphi/test/keywords/ReservedKeywords.thrift
index 8db3ea5..2f49d74 100644
--- a/lib/delphi/test/codegen/ReservedKeywords.thrift
+++ b/lib/delphi/test/keywords/ReservedKeywords.thrift
@@ -18,7 +18,9 @@
*/
// make sure generated code does not produce name collisions with predefined keywords
+namespace delphi System
+include "ReservedIncluded.thrift"
typedef i32 Cardinal
@@ -98,3 +100,39 @@
}
+typedef i32 IProtocol
+typedef i32 ITransport
+typedef i32 IFace
+typedef i32 IAsync
+typedef i32 System
+typedef i32 SysUtils
+typedef i32 Generics
+typedef i32 Thrift
+
+struct Struct_Thrift_Names {
+ 1: IProtocol IProtocol
+ 2: ITransport ITransport
+ 3: IFace IFace
+ 4: IAsync IAsync
+ 5: System System
+ 6: SysUtils SysUtils
+ 7: Generics Generics
+ 8: Thrift Thrift
+}
+
+
+enum Thrift4554_Enum {
+ Foo = 0,
+ Bar = 1,
+ Baz = 2,
+}
+
+struct Thrift4554_Struct {
+ 1 : optional double MinValue
+ 2 : optional double MaxValue
+ 3 : optional bool Integer // causes issue
+ 4 : optional Thrift4554_Enum Foo
+}
+
+
+// EOF