Skip to content

Commit

Permalink
update tests, change warning to error
Browse files Browse the repository at this point in the history
  • Loading branch information
dsyme committed May 12, 2015
1 parent 53153b8 commit 220131b
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 27 deletions.
8 changes: 2 additions & 6 deletions src/fsharp/check.fs
Original file line number Diff line number Diff line change
Expand Up @@ -353,13 +353,9 @@ let CheckType permitByrefs (cenv:cenv) env m ty =
let visitTypar (env,tp) =
if not (env.boundTypars.ContainsKey tp) then
if tp.IsCompilerGenerated then
warning(Error(FSComp.SR.checkNotSufficientlyGenericBecauseOfScopeAnon(),m))
errorR (Error(FSComp.SR.checkNotSufficientlyGenericBecauseOfScopeAnon(),m))
else
warning(Error(FSComp.SR.checkNotSufficientlyGenericBecauseOfScope(tp.DisplayName),m))
//match tp.Rigidity with
//| TyparRigidity.Rigid -> warning(Error(FSComp.SR.checkNotSufficientlyGenericBecauseOfScope(tp.),m))
//| _ -> warning(Error(FSComp.SR.checkNotSufficientlyGenericBecauseOfScope(mtext),m))

errorR (Error(FSComp.SR.checkNotSufficientlyGenericBecauseOfScope(tp.DisplayName),m))

let visitTyconRef tcref =
if not permitByrefs && isByrefLikeTyconRef cenv.g tcref then
Expand Down
3 changes: 3 additions & 0 deletions tests/fsharp/typecheck/sigs/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ REM Configure the sample, i.e. where to find the F# compiler and C# compiler.

call %~d0%~p0..\..\..\config.bat

call ..\..\single-neg-test.bat neg93
@if ERRORLEVEL 1 goto Error

"%FSC%" --noframework -r:"%FSCOREDLLPATH%" -r:"%X86_PROGRAMFILES%\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll" -r:"%X86_PROGRAMFILES%\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Core.dll" -r:"%X86_PROGRAMFILES%\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.dll" -r:"%X86_PROGRAMFILES%\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll" -r:"%X86_PROGRAMFILES%\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Numerics.dll" -a -o:pos21.dll pos21.fs
@if ERRORLEVEL 1 goto Error

Expand Down
21 changes: 0 additions & 21 deletions tests/fsharp/typecheck/sigs/neg91.fs
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,3 @@ module TestExperimentalSet =
A.x <- 1


// See https://github.com/Microsoft/visualfsharp/issues/32
module Repro1 =
type T1<'TError>(xx:'TError) =
member x.Foo() = T2.Bar(xx)
and T2 =
static member Bar(arg) = 0

//let rec f1<'TError>(xx:'TError) = f2(xx)
//and f2(arg) = 0

module Repro2 =
type T1<'TError>(thisActuallyHasToBeHere:'TError) =
member x.Foo() = T2.Bar(failwith "!" : option<'TError>)
and T2 =
static member Bar(arg:option<_>) = 0

module Repro3 =

let rec foo< > c = bar c
and bar c = 0

6 changes: 6 additions & 0 deletions tests/fsharp/typecheck/sigs/neg93.bsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

neg93.fs(8,19,8,22): typecheck error FS3186: Type inference caused the type variable TError to escape its scope. Consider adding an explicit type parameter declaration or adjusting your code to be less generic.

neg93.fs(17,17,17,20): typecheck error FS3186: Type inference caused the type variable TError to escape its scope. Consider adding an explicit type parameter declaration or adjusting your code to be less generic.

neg93.fs(21,10,21,13): typecheck error FS3187: Type inference caused an inference type variable to escape its scope. Consider adding type annotations to make your code less generic.
23 changes: 23 additions & 0 deletions tests/fsharp/typecheck/sigs/neg93.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace Neg93

// See https://github.com/Microsoft/visualfsharp/issues/32
module Repro1 =
type T1<'TError>(xx:'TError) =
member x.Foo() = T2.Bar(xx)
and T2 =
static member Bar(arg) = 0

//let rec f1<'TError>(xx:'TError) = f2(xx)
//and f2(arg) = 0

module Repro2 =
type T1<'TError>(thisActuallyHasToBeHere:'TError) =
member x.Foo() = T2.Bar(failwith "!" : option<'TError>)
and T2 =
static member Bar(arg:option<_>) = 0

module Repro3 =

let rec foo< > c = bar c
and bar c = 0

0 comments on commit 220131b

Please sign in to comment.