@@ -646,16 +646,16 @@ let OutputPhasedErrorR (os:StringBuilder) (err:PhasedDiagnostic) =
646646let t1 , t2 , _cxs = NicePrint.minimalStringsOfTwoTypes denv t1 t2
647647
648648match contextInfowith
649- | ContextInfo.IfExpression rangewhen range = m-> os.Append( FSComp.SR.ifExpression( t1, t2)) |> ignore
650- | ContextInfo.CollectionElement( isArray, range) when range = m->
649+ | ContextInfo.IfExpression rangewhen Range.equals range m-> os.Append( FSComp.SR.ifExpression( t1, t2)) |> ignore
650+ | ContextInfo.CollectionElement( isArray, range) when Range.equals range m->
651651if isArraythen
652652 os.Append( FSComp.SR.arrayElementHasWrongType( t1, t2)) |> ignore
653653else
654654 os.Append( FSComp.SR.listElementHasWrongType( t1, t2)) |> ignore
655- | ContextInfo.OmittedElseBranch rangewhen range = m-> os.Append( FSComp.SR.missingElseBranch( t2)) |> ignore
656- | ContextInfo.ElseBranchResult rangewhen range = m-> os.Append( FSComp.SR.elseBranchHasWrongType( t1, t2)) |> ignore
657- | ContextInfo.FollowingPatternMatchClause rangewhen range = m-> os.Append( FSComp.SR.followingPatternMatchClauseHasWrongType( t1, t2)) |> ignore
658- | ContextInfo.PatternMatchGuard rangewhen range = m-> os.Append( FSComp.SR.patternMatchGuardIsNotBool( t2)) |> ignore
655+ | ContextInfo.OmittedElseBranch rangewhen Range.equals range m-> os.Append( FSComp.SR.missingElseBranch( t2)) |> ignore
656+ | ContextInfo.ElseBranchResult rangewhen Range.equals range m-> os.Append( FSComp.SR.elseBranchHasWrongType( t1, t2)) |> ignore
657+ | ContextInfo.FollowingPatternMatchClause rangewhen Range.equals range m-> os.Append( FSComp.SR.followingPatternMatchClauseHasWrongType( t1, t2)) |> ignore
658+ | ContextInfo.PatternMatchGuard rangewhen Range.equals range m-> os.Append( FSComp.SR.patternMatchGuardIsNotBool( t2)) |> ignore
659659| _ -> os.Append( ConstraintSolverTypesNotInEqualityRelation2E() .Format t1 t2) |> ignore
660660if m.StartLine<> m2.StartLinethen
661661 os.Append( SeeAlsoE() .Format( stringOfRange m)) |> ignore
@@ -683,16 +683,16 @@ let OutputPhasedErrorR (os:StringBuilder) (err:PhasedDiagnostic) =
683683&& typeEquiv g t2 t2'->
684684let t1 , t2 , tpcs = NicePrint.minimalStringsOfTwoTypes denv t1 t2
685685match contextInfowith
686- | ContextInfo.IfExpression rangewhen range = m-> os.Append( FSComp.SR.ifExpression( t1, t2)) |> ignore
687- | ContextInfo.CollectionElement( isArray, range) when range = m->
686+ | ContextInfo.IfExpression rangewhen Range.equals range m-> os.Append( FSComp.SR.ifExpression( t1, t2)) |> ignore
687+ | ContextInfo.CollectionElement( isArray, range) when Range.equals range m->
688688if isArraythen
689689 os.Append( FSComp.SR.arrayElementHasWrongType( t1, t2)) |> ignore
690690else
691691 os.Append( FSComp.SR.listElementHasWrongType( t1, t2)) |> ignore
692- | ContextInfo.OmittedElseBranch rangewhen range = m-> os.Append( FSComp.SR.missingElseBranch( t2)) |> ignore
693- | ContextInfo.ElseBranchResult rangewhen range = m-> os.Append( FSComp.SR.elseBranchHasWrongType( t1, t2)) |> ignore
694- | ContextInfo.FollowingPatternMatchClause rangewhen range = m-> os.Append( FSComp.SR.followingPatternMatchClauseHasWrongType( t1, t2)) |> ignore
695- | ContextInfo.PatternMatchGuard rangewhen range = m-> os.Append( FSComp.SR.patternMatchGuardIsNotBool( t2)) |> ignore
692+ | ContextInfo.OmittedElseBranch rangewhen Range.equals range m-> os.Append( FSComp.SR.missingElseBranch( t2)) |> ignore
693+ | ContextInfo.ElseBranchResult rangewhen Range.equals range m-> os.Append( FSComp.SR.elseBranchHasWrongType( t1, t2)) |> ignore
694+ | ContextInfo.FollowingPatternMatchClause rangewhen Range.equals range m-> os.Append( FSComp.SR.followingPatternMatchClauseHasWrongType( t1, t2)) |> ignore
695+ | ContextInfo.PatternMatchGuard rangewhen Range.equals range m-> os.Append( FSComp.SR.patternMatchGuardIsNotBool( t2)) |> ignore
696696| ContextInfo.TupleInRecordFields->
697697 os.Append( ErrorFromAddingTypeEquation1E() .Format t2 t1 tpcs) |> ignore
698698 os.Append( System.Environment.NewLine+ FSComp.SR.commaInsteadOfSemicolonInRecord()) |> ignore
@@ -1640,7 +1640,7 @@ type Diagnostic =
16401640/// returns sequence that contains Diagnostic for the given error + Diagnostic for all related errors
16411641let CollectDiagnostic ( implicitIncludeDir , showFullPaths , flattenErrors , errorStyle , isError , err : PhasedDiagnostic ) =
16421642let outputWhere ( showFullPaths , errorStyle ) m : DiagnosticLocation =
1643- if m = rangeStartup|| m = rangeCmdArgsthen
1643+ if Range.equals m rangeStartup|| Range.equals m rangeCmdArgsthen
16441644{ Range= m; TextRepresentation= " " ; IsEmpty= true ; File= " " }
16451645else
16461646let file = m.FileName
@@ -1675,7 +1675,7 @@ let CollectDiagnostic (implicitIncludeDir, showFullPaths, flattenErrors, errorSt
16751675| ErrorStyle.VSErrors->
16761676// Show prefix only for real files. Otherwise, we just want a truncated error like:
16771677// parse error FS0031 : blah blah
1678- if m <> range0&& m <> rangeStartup&& m <> rangeCmdArgsthen
1678+ if not ( Range.equals m range0) && not ( Range.equals m rangeStartup) && not ( Range.equals m rangeCmdArgs) then
16791679let file = file.Replace( " /" , " \\ " )
16801680let m = mkRange m.FileName( mkPos m.StartLine( m.StartColumn+ 1 )) ( mkPos m.EndLine( m.EndColumn+ 1 ) )
16811681 sprintf" %s (%d ,%d ,%d ,%d ):" file m.StartLine m.StartColumn m.EndLine m.EndColumn, m, file
@@ -2610,12 +2610,12 @@ type TcConfigBuilder =
26102610member tcConfigB.AddReferencedAssemblyByPath ( m , path ) =
26112611if FileSystem.IsInvalidPathShim( path) then
26122612 warning( Error( FSComp.SR.buildInvalidAssemblyName( path), m))
2613- elif not ( tcConfigB.referencedDLLs|> List.exists( fun ar2 -> m = ar2.Range&& path= ar2.Text)) then // NOTE: We keep same paths if range is different.
2613+ elif not ( tcConfigB.referencedDLLs|> List.exists( fun ar2 -> Range.equals m ar2.Range&& path= ar2.Text)) then // NOTE: We keep same paths if range is different.
26142614let projectReference = tcConfigB.projectReferences|> List.tryPick( fun pr -> if pr.FileName= paththen Some prelse None)
26152615 tcConfigB.referencedDLLs<- tcConfigB.referencedDLLs++ AssemblyReference( m, path, projectReference)
26162616
26172617member tcConfigB.RemoveReferencedAssemblyByPath ( m , path ) =
2618- tcConfigB.referencedDLLs<- tcConfigB.referencedDLLs|> List.filter( fun ar -> ar.Range<> m || ar.Text<> path)
2618+ tcConfigB.referencedDLLs<- tcConfigB.referencedDLLs|> List.filter( fun ar -> not ( Range.equals ar.Rangem ) || ar.Text<> path)
26192619
26202620static member SplitCommandLineResourceInfo ( ri : string ) =
26212621let p = ri.IndexOf','
@@ -2760,7 +2760,7 @@ type TcConfig private (data : TcConfigBuilder, validate:bool) =
27602760 r, Some( filename)
27612761else
27622762// If the file doesn't exist, let reference resolution logic report the error later...
2763- defaultCoreLibraryReference, if r.Range= rangeStartupthen Some( filename) else None
2763+ defaultCoreLibraryReference, if Range.equals r.Range rangeStartupthen Some( filename) else None
27642764match data.referencedDLLs|> List.filter( fun assemblyReference -> assemblyReference.SimpleAssemblyNameIs libraryName) with
27652765| [ r] -> nameOfDll r
27662766| [] ->
@@ -3110,7 +3110,13 @@ type TcConfig private (data : TcConfigBuilder, validate:bool) =
31103110// file is included in the search path. This should ideally already be one of the search paths, but
31113111// during some global checks it won't be. We append to the end of the search list so that this is the last
31123112// place that is checked.
3113- if m<> range0&& m<> rangeStartup&& m<> rangeCmdArgs&& FileSystem.IsPathRootedShim m.FileNamethen
3113+ let isPoundRReference ( r : range ) =
3114+ not ( Range.equals r range0) &&
3115+ not ( Range.equals r rangeStartup) &&
3116+ not ( Range.equals r rangeCmdArgs) &&
3117+ FileSystem.IsPathRootedShim r.FileName
3118+
3119+ if isPoundRReference mthen
31143120 tcConfig.GetSearchPathsForLibraryFiles() @ [ Path.GetDirectoryName( m.FileName)]
31153121else
31163122 tcConfig.GetSearchPathsForLibraryFiles()
@@ -5216,7 +5222,7 @@ module private ScriptPreprocessClosure =
52165222match GetRangeOfDiagnostic exnwith
52175223| Some m->
52185224// Return true if the error was *not* from a #load-ed file.
5219- let isArgParameterWhileNotEditing = ( codeContext<> CodeContext.Editing) && ( m = range0|| m = rangeStartup|| m = rangeCmdArgs)
5225+ let isArgParameterWhileNotEditing = ( codeContext<> CodeContext.Editing) && ( Range.equals m range0|| Range.equals m rangeStartup|| Range.equals m rangeCmdArgs)
52205226let isThisFileName = ( 0 = String.Compare( rootFilename, m.FileName, StringComparison.OrdinalIgnoreCase))
52215227 isArgParameterWhileNotEditing|| isThisFileName
52225228| None-> true