@@ -236,7 +236,13 @@ sanity SymV{pos, name, typ, nativ = Just item, pur, throwing, over}
236236 | otherwise = do
237237 g <- getST
238238 case isMutable g tau of
239- Just (p, r) -> goodMutable g phantom p r tau >> return ()
239+ Just (p, r) -> do
240+ goodMutable g phantom p r tau
241+ case phantom of
242+ -- warn if we have a mutable result of a non-function
243+ Nothing | null args = U. warn pos (msgdoc(" note that the java expression "
244+ ++ item ++ " is supposed to be constant." ))
245+ other = return ()
240246 Nothing -> case U. instTauSym tau g of
241247 Just SymT {nativ = Just nt, pur = pureType}
242248 | ! pureType = case phantom of
@@ -390,7 +396,8 @@ sanity SymV{pos, name, typ, nativ = Just item, pur, throwing, over}
390396 ++ nicer tau g ++ " is illegal, "
391397 ++ " a pure native type must not be wrapped in Mutable." ))
392398 return Nothing
393- else return (Just r)
399+ else do
400+ return (Just r)
394401 | otherwise = do
395402 U. error (getpos r) (msgdoc (" The type "
396403 ++ nicer tau g ++ " is illegal, "
@@ -440,7 +447,9 @@ isEither t = case Tau.flat t of
440447 [TCon {name}, a, b] | name == eitherName = Just (a, b)
441448 _ -> Nothing
442449
443- --- check if _tau_ is (Mutable a b) and return Just (a,b) if this is so.
450+ --- > isMutable g tau
451+ --- Checks if _tau_ is @(Mutable a b)@ and return @Just (a,b)@ if this is so.
452+ --- If _tau_ is a native mutable only type, it returns @Just (RealWorld, tau)@
444453isMutable g t = case Tau. flat t of
445454 [TCon {name}, a, b] | name == mutableName = Just (a, b)
446455 _ -> case U. instTauSym t g of
0 commit comments