Skip to content

Commit fa8b718

Browse files
committed
CodeAction: fixed add default type to satisfy one constraint
1 parent 57dccc2 commit fa8b718

File tree

1 file changed

+9
-0
lines changed
  • plugins/hls-refactor-plugin/src/Development/IDE/Plugin

1 file changed

+9
-0
lines changed

plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs

+9
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,14 @@ suggestAddTypeAnnotationToSatisfyConstraints sourceOpt Diagnostic{_range=_range,
808808
| otherwise = []
809809
where
810810
makeAnnotatedLit ty lit = "(" <> lit <> " :: " <> ty <> ")"
811+
#if MIN_VERSION_ghc(9,8,0)
812+
pat multiple _ _ _ = T.concat [ ".*Defaulting the type variable "
813+
, ".*to type ‘([^ ]+)’ "
814+
, "in the following constraint"
815+
, if multiple then "s" else " "
816+
, ".*arising from the literal ‘(.+)’"
817+
]
818+
#else
811819
#if MIN_VERSION_ghc(9,4,0)
812820
pat multiple at inArg inExpr = T.concat [ ".*Defaulting the type variable "
813821
, ".*to type ‘([^ ]+)’ "
@@ -829,6 +837,7 @@ suggestAddTypeAnnotationToSatisfyConstraints sourceOpt Diagnostic{_range=_range,
829837
, if inExpr then ".+In the expression" else ""
830838
, ".+In the expression"
831839
]
840+
#endif
832841
#endif
833842
codeEdit range ty lit replacement =
834843
let title = "Add type annotation ‘" <> ty <> "’ to ‘" <> lit <> ""

0 commit comments

Comments
 (0)