Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
1e00e9d
migrate (as a separate copy) fsharpqa tests that are going to be impa…
smoothdeveloper Apr 30, 2019
0f01896
update the .bsl files
smoothdeveloper Apr 30, 2019
8b0c809
remove comments that are handled by baseline files, update baseline f…
smoothdeveloper Apr 30, 2019
15823c0
remove the migrated tests from fsharpqa tests
smoothdeveloper Apr 30, 2019
7d6b203
need to be more careful when migrating those
smoothdeveloper Apr 30, 2019
d4c378e
testing if running the test with .fs instead of .fsx makes them work …
smoothdeveloper Apr 30, 2019
efd70e3
exclude migrated fsharpqa from dotnet core run
smoothdeveloper Apr 30, 2019
b343d33
sample test in fsharpqa (can't run locally for now)
smoothdeveloper Apr 20, 2019
05b6055
trying to make it green now.
smoothdeveloper Apr 21, 2019
2a4ccdc
checking if this path is covered by a test, trying to identify how to…
smoothdeveloper Apr 21, 2019
3eab5f2
* [MethodCalls.fs] Defining CallerArgs<'T> in, this replaces passing …
smoothdeveloper Apr 22, 2019
d59606d
bit of refactoring of error message building logic during failed over…
smoothdeveloper Apr 23, 2019
bd2932d
(buildfix) harmonizing .fsi/.fs right before commit doesn't always wo…
smoothdeveloper Apr 23, 2019
723eb07
trying to check what kind of things break loose when I change this
smoothdeveloper Apr 24, 2019
fdb48e1
(minor) [ConstraintSolver.fs] revert space mishapps to reduce diff, p…
smoothdeveloper Apr 24, 2019
2e74e08
toward displaying the argument names properly (may fail some fsharpqa…
smoothdeveloper Apr 24, 2019
f41a791
missing Resharper's Ctrl+Alt+V "introduce variable" refactoring @audu…
smoothdeveloper Apr 24, 2019
9d76863
pretty print unresolved overloads without all the type submsumption p…
smoothdeveloper Apr 25, 2019
7437b53
Overload resolution error messages: things display like I want in fsi…
smoothdeveloper Apr 25, 2019
ed466df
adjust message for candidates overload
smoothdeveloper Apr 26, 2019
3b1fe30
Refactoring around `CallerArg`
smoothdeveloper Apr 27, 2019
b2a5946
Hijack the split phase for UnresolvedOverloading, remove the match on…
smoothdeveloper Apr 29, 2019
950d64f
updating existing failing baseline files that looks correct to me
smoothdeveloper Apr 29, 2019
c1d9619
quickfix for update.base.line.with.actuals.fsx so that it skips missi…
smoothdeveloper Apr 29, 2019
797a31d
(minor) minimize diff, typos, comments
smoothdeveloper Apr 30, 2019
1df43c1
fix vsintegration tests affected by overload error message changes
smoothdeveloper Apr 30, 2019
5a3f77e
merge issue unused variable warning
smoothdeveloper Apr 30, 2019
1e26d72
update the 12 fsharpqa migrated baseline with new error messages
smoothdeveloper Apr 30, 2019
dc40085
(minor) baseline update script
smoothdeveloper Apr 30, 2019
ededba9
move System.Convert.ToString and System.Threading.Tasks.Task.Run test…
smoothdeveloper Apr 30, 2019
4118790
* moving 3 fsharpqa tests to new test suite
smoothdeveloper May 2, 2019
2d2ee31
consolidate all string building logic in CompileOps.fs, fix remaining…
smoothdeveloper May 2, 2019
70ebbcd
update base lines
smoothdeveloper May 2, 2019
3882a83
remove the migrated tests from fsharpqa
smoothdeveloper May 2, 2019
b86d5b9
fix vstest error message
smoothdeveloper May 2, 2019
062f1ac
fix env.lst, removed wrong one...
smoothdeveloper May 2, 2019
d8503be
update baselines of remaining tests
smoothdeveloper May 2, 2019
b90c37d
adding one simple test with many overloads
smoothdeveloper May 2, 2019
3749dc7
appropriate /// comments on `CalledMeth` constructor arguments
smoothdeveloper May 2, 2019
1b2a7f5
minimize diff / formatting
smoothdeveloper May 2, 2019
68792c5
trim unused code
smoothdeveloper May 2, 2019
56ab693
add simple test, one message is interesting, mentioning parameter cou…
smoothdeveloper May 3, 2019
5d23a08
comment flaky test for now
smoothdeveloper May 3, 2019
dd376f3
code review on the `coerceExpr` function from @tihan, we can discard …
smoothdeveloper May 8, 2019
d90439a
code formatting remarks on ConstraintSolver.fs/fsi
smoothdeveloper May 14, 2019
e138e94
`CallerArg`: use plain constructor rather than functions
smoothdeveloper May 14, 2019
ee8af88
(minor) formatting
smoothdeveloper May 14, 2019
3ecd438
format known argument type / updating .bsl
smoothdeveloper May 16, 2019
b58bb44
update missing baseline
smoothdeveloper May 16, 2019
b6c628e
update missing baselines
smoothdeveloper May 16, 2019
3acee0f
update missing baseline
smoothdeveloper May 16, 2019
d6b1198
minor: make TTrait better in debugger display
smoothdeveloper Aug 24, 2019
8c01c6a
[wip] pass TraitConstraintInfo around failed overload resolution erro…
smoothdeveloper Aug 24, 2019
5326132
minimize diff
smoothdeveloper Aug 27, 2019
06d622f
fix missing calls to CallerArgs.make that should be a plain record in…
smoothdeveloper Aug 27, 2019
4ff46a0
signature file mismatch
smoothdeveloper Aug 27, 2019
fec7374
removing duplicate in fscomp.txt
smoothdeveloper Dec 27, 2019
47f2217
surfacing initial bits of TraitConstraintInfo, roughly for now
smoothdeveloper Dec 27, 2019
650a25e
formatting types of known argument in one go, the formatting is still…
smoothdeveloper Jan 12, 2020
b1067f4
rework of overload failure message to prettify *ALL* types in a singl…
smoothdeveloper Jan 15, 2020
2a02797
fixup the tests and add two tests
smoothdeveloper Jan 15, 2020
31302fb
updating baselines that got tighter.
smoothdeveloper Jan 16, 2020
e5d87db
simplify handling of TraitConstraintInfo
smoothdeveloper Jan 16, 2020
1c7c5dd
naming couple of fields and turning a property to a methods as it tri…
smoothdeveloper Jan 17, 2020
82b8585
comments in the assembling of overload resolution error message
smoothdeveloper Jan 17, 2020
fdabb8d
Add information about which argument doesn't match
smoothdeveloper Jan 19, 2020
1ce83b7
minor updates to testguide and devguide
smoothdeveloper Jan 19, 2020
94fe319
fix PrimitiveConstraints.``Invalid object constructor`` test
smoothdeveloper Jan 19, 2020
88883f2
fix(?) salsa tests
smoothdeveloper Jan 19, 2020
0ef5c5a
minimize diff
smoothdeveloper Jan 19, 2020
94fc0aa
put back tests under !FSHARP_SUITE_DRIVES_CORECLR_TESTS
smoothdeveloper Jan 19, 2020
16204ef
missing updated message
smoothdeveloper Jan 19, 2020
2b81768
minor adjustments to TESTGUIDE.md
smoothdeveloper Jan 19, 2020
f5b33dd
return type was missing prettifying in prettyLayoutsOfUnresolvedOverl…
smoothdeveloper Jan 19, 2020
dafdf5c
address code review nits / minimize diff / add comment on PrettifyDis…
smoothdeveloper Jan 22, 2020
a51e852
minimize diff
smoothdeveloper Jan 22, 2020
f2bb3b8
proposed work around the flaky error message until https://github.com…
smoothdeveloper Jan 22, 2020
46bb5d5
fixing baselines of new tests from master
smoothdeveloper Jan 22, 2020
e50cfba
sisyphus round of baseline update
smoothdeveloper Jan 22, 2020
9246b82
removing type which isn't in use and popped back up after rebase
smoothdeveloper Jan 22, 2020
d5edf2c
minimize diff
smoothdeveloper Jan 23, 2020
69bcd70
tidy inconsistent tuple literal
smoothdeveloper Jan 23, 2020
fd48d39
* removing TTrait properties that end up not being used
smoothdeveloper Jan 23, 2020
27c0806
minimize diff
smoothdeveloper Jan 23, 2020
000d414
minimize diff
smoothdeveloper Jan 23, 2020
faf86ad
minimize diff
smoothdeveloper Jan 23, 2020
b968b15
link to usage example in same file
smoothdeveloper Jan 24, 2020
f302e63
revert converting CallerArg single cased DU into Record
smoothdeveloper Jan 29, 2020
546b8ec
minimize diff
smoothdeveloper Jan 29, 2020
bddf474
minimize diff
smoothdeveloper Jan 29, 2020
6c2aa58
minimize diff
smoothdeveloper Jan 29, 2020
26fab46
minimize diff
smoothdeveloper Jan 29, 2020
50c8414
minimize diff
smoothdeveloper Jan 29, 2020
bba6a44
Update Makefile
smoothdeveloper Feb 15, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DEVGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Building is simple:

Desktop tests can be run with:

build.cmd -test
build.cmd -test -c Release

After you build the first time you can open and use this solution in Visual Studio:

Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ test: build

clean:
rm -rf $(CURDIR)/artifacts

20 changes: 13 additions & 7 deletions TESTGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@

To run tests, use variations such as the following, depending on which test suite and build configuration you want:

build.cmd test
build.cmd net40 test
build.cmd coreclr test
build.cmd vs test
build.cmd all test
.\build -testAll -c Release
.\build -test -c Release
.\build -testCambridge -c Release
.\build -testCompiler -c Release
.\build -testDependencyManager -c Release
.\build -testDesktop -c Release
.\build -testCoreClr -c Release
.\build -testFSharpCore -c Release
.\build -testFSharpQA -c Release
.\build -testScripting -c Release
.\build -testVs -c Release

You can also submit pull requests to https://github.com/dotnet/fsharp and run the tests via continuous integration. Most people do wholesale testing that way.

Expand Down Expand Up @@ -48,7 +54,7 @@ There are also negative tests checking code expected to fail compilation. See no

The FSharpQA suite relies on [Perl](http://www.perl.org/get.html), StrawberryPerl package from nuget is used automatically by the test suite.

These tests use the `RunAll.pl` framework to execute, however the easiest way to run them is via the `build.cmd` script, see [usage examples](https://github.com/Microsoft/visualfsharp/blob/master/build.cmd#L31).
These tests use the `RunAll.pl` framework to execute, however the easiest way to run them is via the `.\build` script, see [usage examples](#quick-start-running-tests).

Tests are grouped in folders per area. Each folder contains a number of source code files and a single `env.lst` file. The `env.lst` file defines a series of test cases, one per line.

Expand All @@ -66,7 +72,7 @@ For the FSharpQA suite, the list of test areas and their associated "tags" is st

Tags are in the left column, paths to to corresponding test folders are in the right column. If no tags are specified, all tests will be run.

If you want to re-run a particular test area, the easiest way to do so is to set a temporary tag for that area in test.lst (e.g. "RERUN") and then pass that as an argument to `build.cmd`: `build.cmd test-net40-fsharpqa include RERUN`.
If you want to re-run a particular test area, the easiest way to do so is to set a temporary tag for that area in test.lst (e.g. "RERUN") and adjust `ttags` [run.fsharpqa.test.fsx script](tests/fsharpqa/run.fsharpqa.test.fsx) and run it.

### FSharp.Compiler.UnitTests, FSharp.Core.UnitTests, VisualFSharp.UnitTests

Expand Down
105 changes: 90 additions & 15 deletions src/fsharp/CompileOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ let GetRangeOfDiagnostic(err: PhasedDiagnostic) =
| NameClash(_, _, _, m, _, _, _)
| UnresolvedOverloading(_, _, _, m)
| UnresolvedConversionOperator (_, _, _, m)
| PossibleOverload(_, _, _, m)
| VirtualAugmentationOnNullValuedType m
| NonVirtualAugmentationOnNullValuedType m
| NonRigidTypar(_, _, _, _, _, m)
Expand Down Expand Up @@ -402,12 +401,9 @@ let warningOn err level specificWarnOn =
| 3180 -> false // abImplicitHeapAllocation - off by default
| _ -> level >= GetWarningLevel err

let SplitRelatedDiagnostics(err: PhasedDiagnostic) =
let SplitRelatedDiagnostics(err: PhasedDiagnostic) : PhasedDiagnostic * PhasedDiagnostic list =
let ToPhased e = {Exception=e; Phase = err.Phase}
let rec SplitRelatedException = function
| UnresolvedOverloading(a, overloads, b, c) ->
let related = overloads |> List.map ToPhased
UnresolvedOverloading(a, [], b, c)|>ToPhased, related
| ConstraintSolverRelatedInformation(fopt, m2, e) ->
let e, related = SplitRelatedException e
ConstraintSolverRelatedInformation(fopt, m2, e.Exception)|>ToPhased, related
Expand Down Expand Up @@ -451,7 +447,6 @@ let ErrorFromApplyingDefault2E() = DeclareResourceString("ErrorFromApplyingDefau
let ErrorsFromAddingSubsumptionConstraintE() = DeclareResourceString("ErrorsFromAddingSubsumptionConstraint", "%s%s%s")
let UpperCaseIdentifierInPatternE() = DeclareResourceString("UpperCaseIdentifierInPattern", "")
let NotUpperCaseConstructorE() = DeclareResourceString("NotUpperCaseConstructor", "")
let PossibleOverloadE() = DeclareResourceString("PossibleOverload", "%s%s")
let FunctionExpectedE() = DeclareResourceString("FunctionExpected", "")
let BakedInMemberConstraintNameE() = DeclareResourceString("BakedInMemberConstraintName", "%s")
let BadEventTransformationE() = DeclareResourceString("BadEventTransformation", "")
Expand Down Expand Up @@ -769,20 +764,100 @@ let OutputPhasedErrorR (os: StringBuilder) (err: PhasedDiagnostic) (canSuggestNa
os.Append(e.ContextualErrorMessage) |> ignore
#endif

| UnresolvedOverloading(_, _, mtext, _) ->
os.Append mtext |> ignore
| UnresolvedOverloading(denv, callerArgs, failure, m) ->

// extract eventual information (return type and type parameters)
// from ConstraintTraitInfo
let knownReturnType, genericParameterTypes =
match failure with
| NoOverloadsFound (cx=Some cx)
| PossibleCandidates (cx=Some cx) -> cx.ReturnType, cx.ArgumentTypes
| _ -> None, []

// prepare message parts (known arguments, known return type, known generic parameters)
let argsMessage, returnType, genericParametersMessage =

let retTy =
knownReturnType
|> Option.defaultValue (TType.TType_var (Typar.NewUnlinked()))

let argRepr =
callerArgs.ArgumentNamesAndTypes
|> List.map (fun (name,tTy) -> tTy, {ArgReprInfo.Name = name |> Option.map (fun name -> Ident(name, range.Zero)); ArgReprInfo.Attribs = []})

let argsL,retTyL,genParamTysL = NicePrint.prettyLayoutsOfUnresolvedOverloading denv argRepr retTy genericParameterTypes

match callerArgs.ArgumentNamesAndTypes with
| [] -> None, Layout.showL retTyL, Layout.showL genParamTysL
| items ->
let args = Layout.showL argsL
let prefixMessage =
match items with
| [_] -> FSComp.SR.csNoOverloadsFoundArgumentsPrefixSingular
| _ -> FSComp.SR.csNoOverloadsFoundArgumentsPrefixPlural
Some (prefixMessage args)
, Layout.showL retTyL
, Layout.showL genParamTysL

let knownReturnType =
match knownReturnType with
| None -> None
| Some _ -> Some (FSComp.SR.csNoOverloadsFoundReturnType returnType)

let genericParametersMessage =
match genericParameterTypes with
| [] -> None
| [_] -> Some (FSComp.SR.csNoOverloadsFoundTypeParametersPrefixSingular genericParametersMessage)
| _ -> Some (FSComp.SR.csNoOverloadsFoundTypeParametersPrefixPlural genericParametersMessage)

let overloadMethodInfo displayEnv m (x: OverloadInformation) =
let paramInfo =
match x.error with
| :? ArgDoesNotMatchError as x ->
let nameOrOneBasedIndexMessage =
x.calledArg.NameOpt
|> Option.map (fun n -> FSComp.SR.csOverloadCandidateNamedArgumentTypeMismatch n.idText)
|> Option.defaultValue (FSComp.SR.csOverloadCandidateIndexedArgumentTypeMismatch ((snd x.calledArg.Position) + 1))
sprintf " // %s" nameOrOneBasedIndexMessage
| _ -> ""

(NicePrint.stringOfMethInfo x.amap m displayEnv x.methodSlot.Method) + paramInfo

let nl = System.Environment.NewLine
let formatOverloads (overloads: OverloadInformation list) =
overloads
|> List.map (overloadMethodInfo denv m)
|> List.sort
|> List.map FSComp.SR.formatDashItem
|> String.concat nl

// assemble final message composing the parts
let msg =
let optionalParts =
[knownReturnType; genericParametersMessage; argsMessage]
|> List.choose id
|> String.concat (nl + nl)
|> function | "" -> String.Empty
| result -> nl + nl + result + nl + nl

match failure with
| NoOverloadsFound (methodName, overloads, _) ->
FSComp.SR.csNoOverloadsFound methodName
+ optionalParts
+ (FSComp.SR.csAvailableOverloads (formatOverloads overloads))
| PossibleCandidates (methodName, [], _) ->
FSComp.SR.csMethodIsOverloaded methodName
| PossibleCandidates (methodName, overloads, _) ->
FSComp.SR.csMethodIsOverloaded methodName
+ optionalParts
+ FSComp.SR.csCandidates (formatOverloads overloads)

os.Append msg |> ignore

| UnresolvedConversionOperator(denv, fromTy, toTy, _) ->
let t1, t2, _tpcs = NicePrint.minimalStringsOfTwoTypes denv fromTy toTy
os.Append(FSComp.SR.csTypeDoesNotSupportConversion(t1, t2)) |> ignore

| PossibleOverload(_, minfo, originalError, _) ->
// print original error that describes reason why this overload was rejected
let buf = new StringBuilder()
OutputExceptionR buf originalError

os.Append(PossibleOverloadE().Format minfo (buf.ToString())) |> ignore

| FunctionExpected _ ->
os.Append(FunctionExpectedE().Format) |> ignore

Expand Down
Loading