Skip to content

Commit

Permalink
Fixes: dotnet#4822 --- Support for arbitrary value in AssemblyInforma…
Browse files Browse the repository at this point in the history
…tionalVersionAttribute (dotnet#5336)

* remove TypeChecker validation

* update testcase baselines

* Update fsharpqa tests

* Feedback

* Update nowarn test
  • Loading branch information
KevinRansom authored Jul 18, 2018
1 parent 4926cdb commit a0a9360
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 14 deletions.
2 changes: 0 additions & 2 deletions build/targets/GenerateAssemblyAttributes.targets
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@

<PropertyGroup>
<GeneratedFSharpAssemblyVersionFile>$(IntermediateOutputPath)$(MSBuildProjectName).AssemblyVersion$(DefaultLanguageSourceExtension)</GeneratedFSharpAssemblyVersionFile>
<!-- AssemblyInformationalVersionAttribute issues a by-design warning if the value passed isn't of the form #.#.#.#, but we specifically want to suppress this to allow the commit hash to be embedded. -->
<NoWarn Condition="'$(Language)' == 'F#'">2003;$(NoWarn)</NoWarn>
</PropertyGroup>

<PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/fsharp/TypeChecker.fs
Original file line number Diff line number Diff line change
Expand Up @@ -17293,7 +17293,6 @@ let TypeCheckOneImplFile
try IL.parseILVersion version |> ignore; true
with _ -> false
match attrName with
| "System.Reflection.AssemblyInformationalVersionAttribute"
| "System.Reflection.AssemblyFileVersionAttribute" //TODO compile error like c# compiler?
| "System.Reflection.AssemblyVersionAttribute" when not (isValid()) ->
warning(Error(FSComp.SR.fscBadAssemblyVersion(attrName, version), range))
Expand Down
5 changes: 2 additions & 3 deletions tests/fsharp/core/versionAttributes/NoWarn2003.fs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
namespace System
open System.Reflection

[<assembly: AssemblyVersionAttribute("5.0.0")>]

do ()

namespace System
open System.Reflection
#nowarn "2003"

[<assembly: AssemblyInformationalVersion("5.0.0-beta024")>]
[<assembly: AssemblyVersion("5.0.0-beta024")>]

do ()
4 changes: 0 additions & 4 deletions tests/fsharp/core/versionAttributes/out.stderr.bsl
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@ Test 2=================================================
NoWarn2003_2.fs(8,6): warning FS0988: Main module of program is empty: nothing will happen when it is run
Test 3=================================================

Warn2003_1.fs(5,42): warning FS2003: The attribute System.Reflection.AssemblyInformationalVersionAttribute specified version '5.0.0-beta024', but this value is invalid and has been ignored

Warn2003_1.fs(7,6): warning FS0988: Main module of program is empty: nothing will happen when it is run
Test 4=================================================

Warn2003_2.fs(4,42): warning FS2003: The attribute System.Reflection.AssemblyInformationalVersionAttribute specified version '5.0.0-beta024', but this value is invalid and has been ignored

Warn2003_2.fs(6,6): warning FS0988: Main module of program is empty: nothing will happen when it is run
Test 5=================================================

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// #Regression #Conformance #DeclarationElements #Attributes
//<Expects id="FS2003" status="warning">The attribute System.Reflection.AssemblyInformationalVersionAttribute specified version '6\.5\.4\.3\.2', but this value is invalid and has been ignored</Expects>
//<Expects id="FS2003" status="warning">The attribute System.Reflection.AssemblyFileVersionAttribute specified version '9\.8\.7\.6\.5', but this value is invalid and has been ignored</Expects>

[<assembly:System.Reflection.AssemblyVersion("1.2.3.4")>]
[<assembly:System.Reflection.AssemblyInformationalVersion("6.5.4.3.2")>]
[<assembly:System.Reflection.AssemblyFileVersion("9.8.7.6.5")>]
do
()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// #Regression #Conformance #DeclarationElements #Attributes
//<Expects id="FS2003" status="warning">The attribute System.Reflection.AssemblyInformationalVersionAttribute specified version '6\.5\.\*\.3', but this value is invalid and has been ignored</Expects>
//<Expects id="FS2003" status="warning">The attribute System.Reflection.AssemblyFileVersionAttribute specified version '9\.8\.\*\.6', but this value is invalid and has been ignored</Expects>

[<assembly:System.Reflection.AssemblyVersion("1.2.3.4")>]
[<assembly:System.Reflection.AssemblyInformationalVersion("6.5.*.3")>]
[<assembly:System.Reflection.AssemblyFileVersionAttribute("9.8.*.6")>]
do
()
Expand Down

0 comments on commit a0a9360

Please sign in to comment.