forked from dotnet/fsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from KevinRansom/dsyme-tuple-spike
Dsyme tuple spike
- Loading branch information
Showing
22 changed files
with
509 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/fsharp/FSharp.Core.Unittests/FSharp.Core/SampleTuples/Properties/AssemblyInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System.Reflection; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("ClassLibrary3")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("ClassLibrary3")] | ||
[assembly: AssemblyCopyright("Copyright © 2016")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
Binary file added
BIN
+46.2 KB
src/fsharp/FSharp.Core.Unittests/FSharp.Core/SampleTuples/System.ValueTuple.dll
Binary file not shown.
131 changes: 131 additions & 0 deletions
131
src/fsharp/FSharp.Core.Unittests/FSharp.Core/SampleTuples/TupleSample.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
using System; | ||
|
||
namespace TupleSample | ||
{ | ||
public class TupleReturns | ||
{ | ||
// Basic Tuple | ||
public static (int, int) GetTuple(int one, int two) | ||
{ | ||
return (one, two); | ||
} | ||
// Basic Tuple with three elements | ||
public static (int, int, int) GetTuple(int one, int two, int three) | ||
{ | ||
return (one, two, three); | ||
} | ||
// Basic Tuple with four elements | ||
public static (int, int, int, int) GetTuple(int one, int two, int three, int four) | ||
{ | ||
return (one, two, three, four); | ||
} | ||
// Basic Tuple with five elements | ||
public static (int, int, int, int, int) GetTuple(int one, int two, int three, int four, int five) | ||
{ | ||
return (one, two, three, four, five); | ||
} | ||
// Basic Tuple with six elements | ||
public static (int, int, int, int, int, int) GetTuple(int one, int two, int three, int four, int five, int six) | ||
{ | ||
return (one, two, three, four, five, six); | ||
} | ||
// Basic Tuple with seven elements | ||
public static (int, int, int, int, int, int, int) GetTuple(int one, int two, int three, int four, int five, int six, int seven) | ||
{ | ||
return (one, two, three, four, five, six, seven); | ||
} | ||
// Basic Tuple with eight elements 7tuple+1tuple via .Rest | ||
public static (int, int, int, int, int, int, int, int) GetTuple(int one, int two, int three, int four, int five, int six, int seven, int eight) | ||
{ | ||
return (one, two, three, four, five, six, seven, eight); | ||
} | ||
// Basic Tuple with nine elements 7tuple+2ttuple via .Rest | ||
public static (int, int, int, int, int, int, int, int, int) GetTuple(int one, int two, int three, int four, int five, int six, int seven, int eight, int nine) | ||
{ | ||
return (one, two, three, four, five, six, seven, eight, nine); | ||
} | ||
// Basic Tuple with ten elements 7tuple+3ttuple via .Rest | ||
public static (int, int, int, int, int, int, int, int, int, int) GetTuple(int one, int two, int three, int four, int five, int six, int seven, int eight, int nine, int ten) | ||
{ | ||
return (one, two, three, four, five, six, seven, eight, nine, ten); | ||
} | ||
// Basic Tuple with fifteen elements 7tuple+7ttuple+1tuple via .Rest | ||
public static (int, int, int, int, int, int, int, int, int, int, int, int, int, int, int) GetTuple(int one, int two, int three, int four, int five, int six, int seven, int eight, int nine, int ten, int eleven, int twelve, int thirteen, int fourteen, int fifteen) | ||
{ | ||
return (one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen); | ||
} | ||
// Basic Tuple with sixteen elements 7tuple+7ttuple+2tuple via .Rest | ||
public static (int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int) GetTuple(int one, int two, int three, int four, int five, int six, int seven, int eight, int nine, int ten, int eleven, int twelve, int thirteen, int fourteen, int fifteen, int sixteen) | ||
{ | ||
return (one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen); | ||
} | ||
// Tuple with various field types | ||
public static (int, float, double, string, int[], object) GetTuple(int one, float two, double three, string four, int[] five, object six) | ||
{ | ||
return (one, two, three, four, five, six); | ||
} | ||
} | ||
public class TupleArguments | ||
{ | ||
// Basic Tuple | ||
public static (int, int) GetTuple( (int, int) t) | ||
{ | ||
return (t.Item1, t.Item2); | ||
} | ||
// Basic Tuple with three elements | ||
public static (int, int, int) GetTuple( (int, int , int) t) | ||
{ | ||
return (t.Item1, t.Item2, t.Item3); | ||
} | ||
// Basic Tuple with four elements | ||
public static (int, int, int, int) GetTuple( (int, int, int , int) t) | ||
{ | ||
return (t.Item1, t.Item2, t.Item3, t.Item4); | ||
} | ||
// Basic Tuple with five elements | ||
public static (int, int, int, int, int) GetTuple( (int, int, int, int, int) t) | ||
{ | ||
return (t.Item1, t.Item2, t.Item3, t.Item4, t.Item5); | ||
} | ||
// Basic Tuple with six elements | ||
public static (int, int, int, int, int, int) GetTuple( (int, int, int, int, int, int) t) | ||
{ | ||
return (t.Item1, t.Item2, t.Item3, t.Item4, t.Item5, t.Item6); | ||
} | ||
// Basic Tuple with seven elements | ||
public static (int, int, int, int, int, int, int) GetTuple((int, int, int, int, int, int, int) t) | ||
{ | ||
return (t.Item1, t.Item2, t.Item3, t.Item4, t.Item5, t.Item6, t.Item7); | ||
} | ||
// Basic Tuple with eight elements 7tuple+1tuple via .Rest | ||
public static (int, int, int, int, int, int, int, int) GetTuple((int, int, int, int, int, int, int, int) t) | ||
{ | ||
return (t.Item1, t.Item2, t.Item3, t.Item4, t.Item5, t.Item6, t.Item7, t.Item8); | ||
} | ||
// Basic Tuple with nine elements 7tuple+2ttuple via .Rest | ||
public static (int, int, int, int, int, int, int, int, int) GetTuple((int, int, int, int, int, int, int, int, int) t) | ||
{ | ||
return (t.Item1, t.Item2, t.Item3, t.Item4, t.Item5, t.Item6, t.Item7, t.Item8, t.Item9); | ||
} | ||
// Basic Tuple with ten elements 7tuple+3ttuple via .Rest | ||
public static (int, int, int, int, int, int, int, int, int, int) GetTuple((int, int, int, int, int, int, int, int, int, int) t) | ||
{ | ||
return (t.Item1, t.Item2, t.Item3, t.Item4, t.Item5, t.Item6, t.Item7, t.Item8, t.Item9, t.Item10); | ||
} | ||
// Basic Tuple with fifteen elements 7tuple+7ttuple+1tuple via .Rest | ||
public static (int, int, int, int, int, int, int, int, int, int, int, int, int, int, int) GetTuple((int, int, int, int, int, int, int, int, int, int, int, int, int, int, int) t) | ||
{ | ||
return (t.Item1, t.Item2, t.Item3, t.Item4, t.Item5, t.Item6, t.Item7, t.Item8, t.Item9, t.Item10, t.Item11, t.Item12, t.Item13, t.Item14, t.Item15); | ||
} | ||
// Basic Tuple with sixteen elements 7tuple+7ttuple+2tuple via .Rest | ||
public static (int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int) GetTuple((int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int) t) | ||
{ | ||
return (t.Item1, t.Item2, t.Item3, t.Item4, t.Item5, t.Item6, t.Item7, t.Item8, t.Item9, t.Item10, t.Item11, t.Item12, t.Item13, t.Item14, t.Item15, t.Item16); | ||
} | ||
// Tuple with various field types | ||
public static (int, float, double, string, int[], object) GetTuple( (int, float, double, string, int[], object) t) | ||
{ | ||
return (t.Item1, t.Item2, t.Item3, t.Item4, t.Item5, t.Item6); | ||
} | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/fsharp/FSharp.Core.Unittests/FSharp.Core/SampleTuples/TupleSample.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>TupleSample</RootNamespace> | ||
<AssemblyName>TupleSample</AssemblyName> | ||
<DefaultLanguage>en-US</DefaultLanguage> | ||
<TargetFrameworkProfile>Profile7</TargetFrameworkProfile> | ||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>.</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System.ValueTuple"> | ||
<HintPath>..\..\..\..\..\packages\System.ValueTuple.4.0.0-rc3-24212-01\lib\netstandard1.1\System.ValueTuple.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="TupleSample.cs" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
Binary file added
BIN
+8 KB
src/fsharp/FSharp.Core.Unittests/FSharp.Core/SampleTuples/TupleSample.dll
Binary file not shown.
Binary file added
BIN
+17.5 KB
src/fsharp/FSharp.Core.Unittests/FSharp.Core/SampleTuples/TupleSample.pdb
Binary file not shown.
19 changes: 19 additions & 0 deletions
19
src/fsharp/FSharp.Core.Unittests/FSharp.Core/SampleTuples/TupleSample.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.25518.1 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TupleSample", "TupleSample.csproj", "{224C7102-CD32-4B92-AEA7-9147F8E70E44}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{224C7102-CD32-4B92-AEA7-9147F8E70E44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{224C7102-CD32-4B92-AEA7-9147F8E70E44}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
9 changes: 9 additions & 0 deletions
9
src/fsharp/FSharp.Core.Unittests/FSharp.Core/SampleTuples/readme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Readme for Tuple samples | ||
========================= | ||
|
||
Used to verify interop between C# Value tuples and the F# struct tuple type. | ||
|
||
Sampletuple.dll is checked in directly and is compiled against the System.Runtime.dll contracts. So should be completely portable. | ||
|
||
|
||
|
Oops, something went wrong.