diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs
index 5f5a532bbfe..2317eb007da 100755
--- a/src/fsharp/CompileOps.fs
+++ b/src/fsharp/CompileOps.fs
@@ -621,7 +621,7 @@ let OutputPhasedErrorR (os:System.Text.StringBuilder) (err:PhasedError) =
(if m.StartLine <> m2.StartLine then
os.Append(SeeAlsoE().Format (stringOfRange m)) |> ignore )
| ConstraintSolverTypesNotInEqualityRelation(denv,(TType_measure _ as t1),(TType_measure _ as t2),m,m2) ->
- // REVIEW: consider if we need to show _cxs (the type parameter constrants)
+ // REVIEW: consider if we need to show _cxs (the type parameter constraints)
let t1, t2, _cxs = NicePrint.minimalStringsOfTwoTypes denv t1 t2
os.Append(ConstraintSolverTypesNotInEqualityRelation1E().Format t1 t2 ) |> ignore
(if m.StartLine <> m2.StartLine then
@@ -633,7 +633,7 @@ let OutputPhasedErrorR (os:System.Text.StringBuilder) (err:PhasedError) =
(if m.StartLine <> m2.StartLine then
os.Append(SeeAlsoE().Format (stringOfRange m)) |> ignore)
| ConstraintSolverTypesNotInSubsumptionRelation(denv,t1,t2,m,m2) ->
- // REVIEW: consider if we need to show _cxs (the type parameter constrants)
+ // REVIEW: consider if we need to show _cxs (the type parameter constraints)
let t1, t2, cxs= NicePrint.minimalStringsOfTwoTypes denv t1 t2
os.Append(ConstraintSolverTypesNotInSubsumptionRelationE().Format t2 t1 cxs) |> ignore
(if m.StartLine <> m2.StartLine then
@@ -654,9 +654,12 @@ let OutputPhasedErrorR (os:System.Text.StringBuilder) (err:PhasedError) =
match contextInfo with
| ContextInfo.OmittedElseBranch -> os.Append(FSComp.SR.missingElseBranch(t2)) |> ignore
| ContextInfo.ElseBranch -> os.Append(FSComp.SR.elseBranchHasWrongType(t1,t2)) |> ignore
- | ContextInfo.TupleInRecordFields ->
+ | ContextInfo.TupleInRecordFields ->
+ os.Append(ErrorFromAddingTypeEquation1E().Format t2 t1 tpcs) |> ignore
+ os.Append(System.Environment.NewLine + FSComp.SR.commaInsteadOfSemicolonInRecord()) |> ignore
+ | _ when t2 = "bool" && t1.EndsWith " ref" ->
os.Append(ErrorFromAddingTypeEquation1E().Format t2 t1 tpcs) |> ignore
- os.Append(System.Environment.NewLine + FSComp.SR.commaInsteadOfSemicolonInRecord()) |> ignore
+ os.Append(System.Environment.NewLine + FSComp.SR.derefInsteadOfNot()) |> ignore
| _ -> os.Append(ErrorFromAddingTypeEquation1E().Format t2 t1 tpcs) |> ignore
| ErrorFromAddingTypeEquation(_,_,_,_,((ConstraintSolverTypesNotInSubsumptionRelation _ | ConstraintSolverError _) as e), _, _) ->
OutputExceptionR os e
diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt
index 02dffd07376..8ce5435962e 100644
--- a/src/fsharp/FSComp.txt
+++ b/src/fsharp/FSComp.txt
@@ -18,6 +18,7 @@ undefinedNamePatternDiscriminator,"The pattern discriminator '%s' is not defined
missingElseBranch,"The 'if' expression is missing an 'else' branch. The 'then' branch has type '%s'. Because 'if' is an expression, and not a statement, add an 'else' branch which returns a value of the same type."
elseBranchHasWrongType,"All branches of an 'if' expression must return the same type. This expression was expected to have type '%s' but here has type '%s'."
commaInsteadOfSemicolonInRecord,"A ';' is used to separate field values in records. Consider replacing ',' with ';'."
+derefInsteadOfNot,"The '!' operator is used to dereference a ref cell. Consider using 'not expr' here."
buildUnexpectedTypeArgs,"The non-generic type '%s' does not expect any type arguments, but here is given %d type argument(s)"
returnUsedInsteadOfReturnBang,"Consider using 'return!' instead of 'return'."
yieldUsedInsteadOfYieldBang,"Consider using 'yield!' instead of 'yield'."
diff --git a/tests/fsharpqa/Source/Warnings/RefCellInsteadOfNot.fs b/tests/fsharpqa/Source/Warnings/RefCellInsteadOfNot.fs
new file mode 100644
index 00000000000..1c6987bfa63
--- /dev/null
+++ b/tests/fsharpqa/Source/Warnings/RefCellInsteadOfNot.fs
@@ -0,0 +1,9 @@
+// #Warnings
+//This expression was expected to have type
+//The '!' operator is used to dereference a ref cell. Consider using 'not expr' here.
+
+let x = true
+if !x then
+ printfn "hello"
+
+exit 0
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/Warnings/RefCellInsteadOfNot2.fs b/tests/fsharpqa/Source/Warnings/RefCellInsteadOfNot2.fs
new file mode 100644
index 00000000000..090934d8f56
--- /dev/null
+++ b/tests/fsharpqa/Source/Warnings/RefCellInsteadOfNot2.fs
@@ -0,0 +1,8 @@
+// #Warnings
+//This expression was expected to have type
+//The '!' operator is used to dereference a ref cell. Consider using 'not expr' here.
+
+let x = true
+let y = !x
+
+exit 0
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/Warnings/env.lst b/tests/fsharpqa/Source/Warnings/env.lst
index 89651c646aa..cb14235cc9c 100644
--- a/tests/fsharpqa/Source/Warnings/env.lst
+++ b/tests/fsharpqa/Source/Warnings/env.lst
@@ -7,6 +7,8 @@
SOURCE=ElseBranchHasWrongType.fs # ElseBranchHasWrongType.fs
SOURCE=MissingExpressionAfterLet.fs # MissingExpressionAfterLet.fs
SOURCE=AssignmentOnImmutable.fs # AssignmentOnImmutable.fs
+ SOURCE=RefCellInsteadOfNot.fs # RefCellInsteadOfNot.fs
+ SOURCE=RefCellInsteadOfNot2.fs # RefCellInsteadOfNot2.fs
SOURCE=UpcastInsteadOfDowncast.fs # UpcastInsteadOfDowncast.fs
SOURCE=UpcastFunctionInsteadOfDowncast.fs # UpcastFunctionInsteadOfDowncast.fs
SOURCE=DowncastInsteadOfUpcast.fs # DowncastInsteadOfUpcast.fs