Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
31ee3a4
relax indentations
dsyme Mar 9, 2019
3fb2e72
fix baseline
dsyme Mar 9, 2019
d1b1389
add diagnostics
dsyme Mar 10, 2019
0f89711
add diagnostics
dsyme Mar 10, 2019
7da6aff
diagnostics
dsyme Mar 11, 2019
871489b
diagnostics
dsyme Mar 11, 2019
27d00a0
diagnostics
dsyme Mar 11, 2019
7d98d16
add diagnostics and possible fix for tp smoke tests
dsyme Mar 11, 2019
cc6e992
fix build
dsyme Mar 11, 2019
e13b385
fix build
dsyme Mar 11, 2019
8832b48
Merge branch 'diag4' into indents5
dsyme Mar 11, 2019
ce0961e
more diagnostics
dsyme Mar 11, 2019
2bb15ce
integrate master
dsyme Mar 11, 2019
5111d4e
Merge branch 'master' of http://github.com/Microsoft/visualfsharp int…
dsyme Mar 11, 2019
51e2012
try to fix flaky test
dsyme Mar 12, 2019
1b12929
Update neg77.fsx
dsyme Mar 12, 2019
26e05dd
fix build
dsyme Mar 12, 2019
434810a
try to fix dodgy test
dsyme Mar 13, 2019
71f51b9
Merge branch 'diag4' into indents5
dsyme Mar 13, 2019
cbd1cf9
Merge branch 'master' of http://github.com/Microsoft/visualfsharp int…
dsyme Mar 13, 2019
49ad748
Merge branch 'indents5' of https://github.com/dsyme/visualfsharp into…
dsyme Mar 13, 2019
9aad485
Merge branch 'master' of http://github.com/Microsoft/visualfsharp int…
dsyme Mar 20, 2019
c921eff
Merge branch 'master' of https://github.com/Microsoft/visualfsharp in…
dsyme Mar 21, 2019
c6b1c8c
merge master
dsyme Mar 26, 2019
7b00422
Merge branch 'master' of http://github.com/Microsoft/visualfsharp int…
dsyme Apr 1, 2019
44790ee
Merge branch 'master' of http://github.com/Microsoft/visualfsharp int…
dsyme Apr 14, 2019
7651e86
Merge branch 'master' of http://github.com/Microsoft/visualfsharp int…
dsyme Apr 16, 2019
705f5d8
Merge branch 'master' of http://github.com/Microsoft/visualfsharp int…
dsyme May 22, 2019
7c3b250
Merge pull request #6826 from dotnet/merges/master-to-feature/relax-i…
May 23, 2019
0325034
Fix unused opens false positive for record fields (#6846)
auduchinok May 24, 2019
4f50cd6
add CI leg to verify assemblies aren't unnecessarily being rebuilt (#…
brettfo May 24, 2019
25560f4
Removing option from Tuple active pattern (#6772)
fangyi-zhou May 24, 2019
d257c8f
Merge pull request #6839 from dotnet/merges/master-to-feature/relax-i…
May 24, 2019
73869ce
Merge pull request #6857 from dotnet/merges/master-to-feature/relax-i…
May 25, 2019
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
13 changes: 13 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,19 @@ jobs:
- script: eng\CIBuild.cmd -configuration Release -noSign /p:DotNetBuildFromSource=true /p:FSharpSourceBuild=true
displayName: Build

# Up-to-date
- job: UpToDate_Windows
pool:
vmImage: windows-2019
steps:
- checkout: self
clean: true
- task: PowerShell@2
displayName: Run up-to-date build check
inputs:
filePath: eng\tests\UpToDate.ps1
arguments: -configuration $(_BuildConfig) -ci -binaryLog

#---------------------------------------------------------------------------------------------------------------------#
# FCS builds #
#---------------------------------------------------------------------------------------------------------------------#
Expand Down
70 changes: 70 additions & 0 deletions eng/tests/UpToDate.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# This script verifies that subsequent calls to `Build.cmd` don't cause assemblies to be unnecessarily rebuilt.

[CmdletBinding(PositionalBinding=$false)]
param (
[string][Alias('c')]$configuration = "Debug",
[parameter(ValueFromRemainingArguments=$true)][string[]]$properties
)

Set-StrictMode -version 2.0
$ErrorActionPreference = "Stop"

try {
$RepoRoot = Join-Path $PSScriptRoot ".." | Join-Path -ChildPath ".." -Resolve
$BuildScript = Join-Path $RepoRoot "Build.cmd"

# do first build
& $BuildScript -configuration $configuration @properties
if ($LASTEXITCODE -ne 0) {
Write-Host "Error running first build."
exit 1
}

# gather assembly timestamps
$ArtifactsBinDir = Join-Path $RepoRoot "artifacts" | Join-Path -ChildPath "bin" -Resolve
$FSharpAssemblyDirs = Get-ChildItem -Path $ArtifactsBinDir -Filter "FSharp.*"
$FSharpAssemblyPaths = $FSharpAssemblyDirs | ForEach-Object { Get-ChildItem -Path (Join-Path $ArtifactsBinDir $_) -Recurse -Filter "$_.dll" } | ForEach-Object { $_.FullName }

$InitialAssembliesAndTimes = @{}
foreach ($asm in $FSharpAssemblyPaths) {
$LastWriteTime = (Get-Item $asm).LastWriteTimeUtc
$InitialAssembliesAndTimes.Add($asm, $LastWriteTime)
}

$InitialCompiledCount = $FSharpAssemblyPaths.Length

# build again
& $BuildScript -configuration $configuration @properties
if ($LASTEXITCODE -ne 0) {
Write-Host "Error running second build."
exit 1
}

# gather assembly timestamps again
$FinalAssembliesAndTimes = @{}
foreach ($asm in $FSharpAssemblyPaths) {
$LastWriteTime = (Get-Item $asm).LastWriteTimeUtc
$FinalAssembliesAndTimes.Add($asm, $LastWriteTime)
}

# validate that assembly timestamps haven't changed
$RecompiledFiles = @()
foreach ($asm in $InitialAssembliesAndTimes.keys) {
$InitialTime = $InitialAssembliesAndTimes[$asm]
$FinalTime = $FinalAssembliesAndTimes[$asm]
if ($InitialTime -ne $FinalTime) {
$RecompiledFiles += $asm
}
}

$RecompiledCount = $RecompiledFiles.Length
Write-Host "$RecompiledCount of $InitialCompiledCount assemblies were re-compiled"
$RecompiledFiles | ForEach-Object { Write-Host " $_" }
exit $RecompiledCount
}
catch {
Write-Host $_
Write-Host $_.Exception
Write-Host $_.ScriptStackTrace
exit 1
}
9 changes: 8 additions & 1 deletion src/fsharp/LexFilter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,13 @@ type LexFilterImpl (lightSyntaxStatus: LightSyntaxStatus, compilingFsLib, lexer,
// 'type C = class ... ' limited by 'type'
// 'type C = interface ... ' limited by 'type'
// 'type C = struct ... ' limited by 'type'
| _, (CtxtParen ((CLASS | STRUCT | INTERFACE), _) :: CtxtSeqBlock _ :: (CtxtTypeDefns _ as limitCtxt) :: _)
| _, (CtxtParen ((CLASS | STRUCT | INTERFACE), _) :: CtxtSeqBlock _ :: (CtxtTypeDefns _ as limitCtxt) :: _)
// 'type C(' limited by 'type'
| _, (CtxtSeqBlock _ :: CtxtParen(LPAREN, _) :: (CtxtTypeDefns _ as limitCtxt) :: _ )
// 'static member C(' limited by 'static', likewise others
| _, (CtxtSeqBlock _ :: CtxtParen(LPAREN, _) :: (CtxtMemberHead _ as limitCtxt) :: _ )
// 'static member P with get() = ' limited by 'static', likewise others
| _, (CtxtWithAsLet _ :: (CtxtMemberHead _ as limitCtxt) :: _ )
-> PositionWithColumn(limitCtxt.StartPos, limitCtxt.StartCol + 1)

// REVIEW: document these
Expand All @@ -780,6 +786,7 @@ type LexFilterImpl (lightSyntaxStatus: LightSyntaxStatus, compilingFsLib, lexer,
// else expr
| (CtxtIf _ | CtxtElse _ | CtxtThen _), (CtxtIf _ as limitCtxt) :: _rest
-> PositionWithColumn(limitCtxt.StartPos, limitCtxt.StartCol)

// Permitted inner-construct precise block alignment:
// while ...
// do expr
Expand Down
10 changes: 10 additions & 0 deletions src/fsharp/service/ServiceAnalysis.fs
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,27 @@ module UnusedOpens =
| :? FSharpMemberOrFunctionOrValue as fv when fv.IsExtensionMember ->
// Extension members should be taken into account even though they have a prefix (as they do most of the time)
true

| :? FSharpMemberOrFunctionOrValue as fv when not fv.IsModuleValueOrMember ->
// Local values can be ignored
false

| :? FSharpMemberOrFunctionOrValue when su.IsFromDefinition ->
// Value definitions should be ignored
false

| :? FSharpGenericParameter ->
// Generic parameters can be ignored, they never come into scope via 'open'
false

| :? FSharpUnionCase when su.IsFromDefinition ->
false

| :? FSharpField as field when
field.DeclaringEntity.IsSome && field.DeclaringEntity.Value.IsFSharpRecord ->
// Record fields are used in name resolution
true

| _ ->
// For the rest of symbols we pick only those which are the first part of a long ident, because it's they which are
// contained in opened namespaces / modules. For example, we pick `IO` from long ident `IO.File.OpenWrite` because
Expand Down
4 changes: 2 additions & 2 deletions src/fsharp/symbols/SymbolPatterns.fs
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ module Symbol =
#endif
let (|Enum|_|) (entity: FSharpEntity) = if entity.IsEnum then Some() else None

let (|Tuple|_|) (ty: FSharpType option) =
ty |> Option.bind (fun ty -> if ty.IsTupleType then Some() else None)
let (|Tuple|_|) (ty: FSharpType) =
if ty.IsTupleType then Some() else None

let (|RefCell|_|) (ty: FSharpType) =
match getAbbreviatedType ty with
Expand Down
2 changes: 1 addition & 1 deletion src/fsharp/symbols/SymbolPatterns.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module public Symbol =
val (|ProvidedAndErasedType|_|) : FSharpEntity -> unit option
#endif
val (|Enum|_|) : FSharpEntity -> unit option
val (|Tuple|_|) : FSharpType option -> unit option
val (|Tuple|_|) : FSharpType -> unit option
val (|RefCell|_|) : FSharpType -> unit option
val (|FunctionType|_|) : FSharpType -> unit option
val (|Pattern|_|) : FSharpSymbol -> unit option
Expand Down
12 changes: 12 additions & 0 deletions tests/fsharp/typecheck/sigs/neg77.bsl
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,15 @@ neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: th
neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (133:19). Try indenting this token further or using standard formatting conventions.

neg77.fsx(134,15,134,16): parse error FS0010: Unexpected symbol '|' in expression

neg77.fsx(259,3,259,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (258:5). Try indenting this token further or using standard formatting conventions.

neg77.fsx(259,3,259,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (258:5). Try indenting this token further or using standard formatting conventions.

neg77.fsx(267,7,267,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (266:9). Try indenting this token further or using standard formatting conventions.

neg77.fsx(267,7,267,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (266:9). Try indenting this token further or using standard formatting conventions.

neg77.fsx(278,7,278,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (277:9). Try indenting this token further or using standard formatting conventions.

neg77.fsx(278,7,278,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (277:9). Try indenting this token further or using standard formatting conventions.
54 changes: 54 additions & 0 deletions tests/fsharp/typecheck/sigs/neg77.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,60 @@ do Application.Run(form)
#endif


open System

type OffsideCheck(a:int,
b:int, c:int, // no warning
d:int, e:int,
f:int) =
static member M(a:int,
b:int, c:int, // no warning
d:int, e:int,
f:int) = 1

module M =
type OffsideCheck(a:int,
b:int, c:int, // warning
d:int, e:int,
f:int) =
class end

module M2 =
type OffsideCheck() =
static member M(a:int,
b:int, c:int, // warning
d:int, e:int,
f:int) = 1

type C() =
static member P with get() =
1 // no warning

module M3 =
type C() =
static member P with get() =
1 // warning


type OffsideCheck2(a:int,
b:int, c:int, // no warning
d:int, e:int,
f:int) =
static member M(a:int,
b:int, c:int, // no warning
d:int, e:int,
f:int) = 1

type OffsideCheck3(a:int,
b:int, c:int, // no warning
d:int, e:int,
f:int) =
static member M(a:int,
b:int, c:int, // no warning
d:int, e:int,
f:int) = 1





Expand Down
24 changes: 24 additions & 0 deletions tests/fsharp/typecheck/sigs/neg77.vsbsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,34 @@ neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: th

neg77.fsx(134,15,134,16): parse error FS0010: Unexpected symbol '|' in expression

neg77.fsx(259,3,259,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (258:5). Try indenting this token further or using standard formatting conventions.

neg77.fsx(259,3,259,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (258:5). Try indenting this token further or using standard formatting conventions.

neg77.fsx(267,7,267,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (266:9). Try indenting this token further or using standard formatting conventions.

neg77.fsx(267,7,267,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (266:9). Try indenting this token further or using standard formatting conventions.

neg77.fsx(278,7,278,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (277:9). Try indenting this token further or using standard formatting conventions.

neg77.fsx(278,7,278,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (277:9). Try indenting this token further or using standard formatting conventions.

neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (133:19). Try indenting this token further or using standard formatting conventions.

neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (133:19). Try indenting this token further or using standard formatting conventions.

neg77.fsx(134,15,134,16): parse error FS0010: Unexpected symbol '|' in expression

neg77.fsx(259,3,259,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (258:5). Try indenting this token further or using standard formatting conventions.

neg77.fsx(259,3,259,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (258:5). Try indenting this token further or using standard formatting conventions.

neg77.fsx(267,7,267,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (266:9). Try indenting this token further or using standard formatting conventions.

neg77.fsx(267,7,267,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (266:9). Try indenting this token further or using standard formatting conventions.

neg77.fsx(278,7,278,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (277:9). Try indenting this token further or using standard formatting conventions.

neg77.fsx(278,7,278,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (277:9). Try indenting this token further or using standard formatting conventions.

neg77.fsx(153,75,153,79): typecheck error FS0001: The type 'Planet * 'a' is not compatible with the type 'Planet'
8 changes: 8 additions & 0 deletions tests/service/ProjectAnalysisTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5523,6 +5523,14 @@ type UseTheThings(i:int) =
member x.UseSomeUsedModuleContainingActivePattern(ActivePattern g) = g
member x.UseSomeUsedModuleContainingExtensionMember() = (3).Q
member x.UseSomeUsedModuleContainingUnion() = A

module M1 =
type R = { Field: int }

module M2 =
open M1

let foo x = x.Field
"""
let fileSource1 = FSharp.Compiler.Text.SourceText.ofString fileSource1Text
File.WriteAllText(fileName1, fileSource1Text)
Expand Down