Skip to content

Commit

Permalink
Merge pull request #7 from KevinRansom/dsyme-tuple-spike
Browse files Browse the repository at this point in the history
Dsyme tuple spike
  • Loading branch information
dsyme authored Jul 25, 2016
2 parents e68c44e + ae16306 commit 6705d23
Show file tree
Hide file tree
Showing 22 changed files with 509 additions and 195 deletions.
13 changes: 9 additions & 4 deletions build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,20 @@ echo Build and run a subset of test suites
echo.
echo Usage:
echo.
echo build.cmd ^<all^|proto^|build^|debug^|release^|diag^|compiler^|coreclr^|pcls^|vs^|ci^|ci_part1^|ci_part2^|microbuild^>
echo build.cmd ^all^|ci^|ci_part1^|ci_part2^|microbuild^|proto^|net40^|coreclr^|debug^|release^|diag^|compiler^|pcls^|vs^
echo ^test-coreunit^|test-corecompile^|test-smoke^|test-coreclr^|test-pcls^|test-fsharp^|test-fsharpqa^|test-vs^
echo.
echo No arguments default to 'build'
echo. rate strings by comma
echo To specify multiple values, sepa
echo.
echo No arguments default to 'build'
echo.This builds the net40 build of the compiler without running tests
echo.
echo To specify multiple values, separate strings by comma
echo. build net40 notests
echo.
echo The example below run pcls, vs and qa:
echo.
echo build.cmd pcls,vs,debug
echo build.cmd pcls,vs,debug
exit /b 1

:ARGUMENTS_OK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
<Reference Include="System.Core" />
<Reference Include="System.Net" Condition="'$(TargetFramework)' == 'sl5' " />
<Reference Include="System.Observable" Condition="'$(TargetFramework)' == 'sl3-wp' " />
<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="NUnitFrameworkShims.fs" Condition="'$(TargetFramework)' == 'sl3-wp'" />
Expand Down
8 changes: 8 additions & 0 deletions src/fsharp/FSharp.Core.Unittests/FSharp.Core.Unittests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@
<Project>{DED3BBD7-53F4-428A-8C9F-27968E768605}</Project>
<Name>FSharp.Core</Name>
</ProjectReference>
<Reference Include="System.ValueTuple" Condition="'$(TargetFramework)' != 'portable47'">
<HintPath>..\..\..\packages\System.ValueTuple.4.0.0-rc3-24212-01\lib\netstandard1.1\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="TupleSample" Condition="'$(TargetFramework)' != 'portable47'">
<Private>True</Private>
<HintPath>..\..\..\src\fsharp\FSharp.Core.Unittests\FSharp.Core\SampleTuples\TupleSample.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'coreclr'">
<Reference Include="nunit.framework, Version=3.0.5797.27550, Culture=neutral, PublicKeyToken=2638cd05610744eb">
Expand Down Expand Up @@ -131,6 +138,7 @@
<Compile Include="FSharp.Core\Microsoft.FSharp.Reflection\FSharpReflection.fs" />
<Compile Include="FSharp.Core\Microsoft.FSharp.Quotations\FSharpQuotations.fs" />
<Compile Include="TypeForwarding.fs" />
<Compile Include="StructTuples.fs" Condition="'$(TargetFramework)' != 'portable47'" />
<Compile Include="SurfaceArea.$(TargetFramework).fs" />
<Compile Include="Program.fs" Condition="'$(TargetFramework)' == 'coreclr'" />
<CustomCopyLocal Include="FSharp.Core.Unittests.dll.config">
Expand Down
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 not shown.
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);
}
}
}
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 not shown.
Binary file not shown.
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
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.



Loading

0 comments on commit 6705d23

Please sign in to comment.