on master help sign in
Readded [static] but with a deprecation warning.
060caf4Ahmad Salim Al-Sibahi
src/Idris/ParseData.hs+1−5
@@ -167,11 +167,7 @@ dataOpts opts
167 <|> return opts
167 <|> return opts
168 <?> "data options"
168 <?> "data options"
169 where warnElim fc =
169 where warnElim fc =
170− do ist <- get
170+ parserWarning fc (Just NoElimDeprecationWarnings) (Msg "The 'class' keyword is deprecated. Use 'interface' instead.")
171− let cmdline = opt_cmdline (idris_options ist)
172− unless (NoElimDeprecationWarnings `elem` cmdline) $
173− put ist { parserWarnings =
174− (fc, Msg "Eliminator generation is deprecated. Use an eliminator generator in a library instead.") : parserWarnings ist }
175
171
176{- | Parses a data type declaration
172{- | Parses a data type declaration
177Data ::= DocComment? Accessibility? DataI DefaultEliminator FnName TypeSig ExplicitTypeDataRest?
173Data ::= DocComment? Accessibility? DataI DefaultEliminator FnName TypeSig ExplicitTypeDataRest?
src/Idris/ParseExpr.hs+5−5
@@ -333,11 +333,7 @@ caseOption syn = do lhs <- expr (syn { inPattern = True })
333
333
334warnTacticDeprecation :: FC -> IdrisParser ()
334warnTacticDeprecation :: FC -> IdrisParser ()
335warnTacticDeprecation fc =
335warnTacticDeprecation fc =
336− do ist <- get
337− let cmdline = opt_cmdline (idris_options ist)
338− unless (NoOldTacticDeprecationWarnings `elem` cmdline) $
339− put ist { parserWarnings =
340− (fc, Msg "This style of tactic proof is deprecated. See %runElab for the replacement.") : parserWarnings ist }
336+ parserWarning fc (Just NoOldTacticDeprecationWarnings) (Msg "This style of tactic proof is deprecated. See %runElab for the replacement.")
341
337
342{- | Parses a proof block
338{- | Parses a proof block
343@
339@
@@ -1390,6 +1386,10 @@ Static ::=
1390-}
1386-}
1391static :: IdrisParser Static
1387static :: IdrisParser Static
1392static = do reserved "%static"; return Static
1388static = do reserved "%static"; return Static
1389+ <|> do reserved "[static]"
1390+ fc <- getFC
1391+ parserWarning fc Nothing (Msg "The use of [static] is deprecated, use %static instead.")
1392+ return Static
1393 <|> return Dynamic
1393 <|> return Dynamic
1394 <?> "static modifier"
1394 <?> "static modifier"
1395
1395
src/Idris/ParseHelpers.hs+7
@@ -666,3 +666,10 @@ collect (PInstance doc argDocs f s cs n nfc ps t en ds : ds')
666 = PInstance doc argDocs f s cs n nfc ps t en (collect ds) : collect ds'
666 = PInstance doc argDocs f s cs n nfc ps t en (collect ds) : collect ds'
667collect (d : ds) = d : collect ds
667collect (d : ds) = d : collect ds
668collect [] = []
668collect [] = []
669+
670+parserWarning :: FC -> Maybe Opt -> Err -> IdrisParser ()
671+parserWarning fc warnOpt warnErr = do
672+ is <- get
673+ let cmdline = opt_cmdline (idris_options ist)
674+ unless (maybe False (`elem` cmdline) warnOpt) $
675+ put ist { parserWarnings = (fc, warnErr) : parserWarnings ist }
src/Idris/Parser.hs+2−9
@@ -878,10 +878,7 @@ class_ syn = do (doc, argDocs, acc)
878 classKeyword = reservedHL "interface"
878 classKeyword = reservedHL "interface"
879 <|> do reservedHL "class"
879 <|> do reservedHL "class"
880 fc <- getFC
880 fc <- getFC
881− ist <- get
882− put ist { parserWarnings =
883− (fc, Msg "The 'class' keyword is deprecated. Use 'interface' instead.")
881+ parserWarning fc Nothing (Msg "The 'class' keyword is deprecated. Use 'interface' instead.")
884− : parserWarnings ist }
885
882
886 carg :: IdrisParser (Name, FC, PTerm)
883 carg :: IdrisParser (Name, FC, PTerm)
887 carg = do lchar '('; (i, ifc) <- name; lchar ':'; ty <- expr syn; lchar ')'
884 carg = do lchar '('; (i, ifc) <- name; lchar ':'; ty <- expr syn; lchar ')'
@@ -928,11 +925,7 @@ instance_ kwopt syn
928 instanceKeyword = reservedHL "implementation"
925 instanceKeyword = reservedHL "implementation"
929 <|> do reservedHL "instance"
926 <|> do reservedHL "instance"
930 fc <- getFC
927 fc <- getFC
931− ist <- get
932− put ist { parserWarnings =
933− (fc, Msg "The 'instance' keyword is deprecated. Use 'implementation' (or omit it) instead.")
928+ parserWarning fc Nothing (Msg "The 'instance' keyword is deprecated. Use 'implementation' (or omit it) instead.")
934− : parserWarnings ist }
935−
936
929
937-- | Parse a docstring
930-- | Parse a docstring
938docstring :: SyntaxInfo
931docstring :: SyntaxInfo