@@ -396,31 +396,11 @@ checkTransparentPragma def = compileFun False def >>= \case
396396 " A transparent function must have exactly one non-erased argument and return it unchanged."
397397
398398
399- -- | Ensure a definition can be defined as inline .
399+ -- | Mark a definition as one that should be inlined .
400400checkInlinePragma :: Definition -> C ()
401- checkInlinePragma def@ Defn {defName = f} = do
402- let Function {funClauses = cs} = theDef def
403- case filter (isJust . clauseBody) cs of
404- [c] ->
405- unlessM (allowedPats (namedClausePats c)) $ agda2hsErrorM $
406- " Cannot make function" <+> prettyTCM (defName def) <+> " inlinable." <+>
407- " Inline functions can only use variable patterns or transparent record constructor patterns."
408- _ ->
409- agda2hsErrorM $
410- " Cannot make function" <+> prettyTCM f <+> " inlinable." <+>
411- " An inline function must have exactly one clause."
412-
413- where allowedPat :: DeBruijnPattern -> C Bool
414- allowedPat VarP {} = pure True
415- -- only allow matching on (unboxed) record constructors
416- allowedPat (ConP ch ci cargs) =
417- isUnboxConstructor (conName ch) >>= \ case
418- Just _ -> allowedPats cargs
419- Nothing -> pure False
420- allowedPat _ = pure False
421-
422- allowedPats :: NAPs -> C Bool
423- allowedPats pats = allM (allowedPat . dget . dget) pats
401+ checkInlinePragma def@ (Defn { defName = q , theDef = df }) = do
402+ let qs = fromMaybe [] $ getMutual_ df
403+ addInlineSymbols $ q : qs
424404
425405checkCompileToFunctionPragma :: Definition -> String -> C ()
426406checkCompileToFunctionPragma def s = noCheckNames $ do
0 commit comments