← 输入框|github.com|刷新
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ If you would prefer to use different terms, please use the section below instead
| [@matthew-hilty](https://github.com/matthew-hilty) | Matthew Hilty | [MIT license](http://opensource.org/licenses/MIT) |
| [@woody88](https://github.com/woody88) | Woodson Delhia | [MIT license](http://opensource.org/licenses/MIT) |
| [@mhmdanas](https://github.com/mhmdanas) | Mohammed Anas | [MIT license](http://opensource.org/licenses/MIT) |
| [@kl0tl](https://github.com/kl0tl) | Cyril Sobierajewicz | [MIT license](http://opensource.org/licenses/MIT) |

### Contributors using Modified Terms

Expand Down
9 changes: 9 additions & 0 deletions src/Language/PureScript/Errors.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ data SimpleErrorMessage
| MissingFFIImplementations ModuleName [Ident]
| UnusedFFIImplementations ModuleName [Ident]
| InvalidFFIIdentifier ModuleName Text
| DeprecatedFFIPrime ModuleName Text
| FileIOError Text IOError -- ^ A description of what we were trying to do, and the error which occurred
| InfiniteType SourceType
| InfiniteKind SourceType
Expand Down Expand Up @@ -221,6 +222,7 @@ errorCode em = case unwrapErrorMessage em of
MissingFFIImplementations{} -> "MissingFFIImplementations"
UnusedFFIImplementations{} -> "UnusedFFIImplementations"
InvalidFFIIdentifier{} -> "InvalidFFIIdentifier"
DeprecatedFFIPrime{} -> "DeprecatedFFIPrime"
FileIOError{} -> "FileIOError"
InfiniteType{} -> "InfiniteType"
InfiniteKind{} -> "InfiniteKind"
Expand Down Expand Up @@ -669,6 +671,13 @@ prettyPrintSingleError (PPEOptions codeColor full level showDocs relPath) e = fl
, line "Note that exported identifiers in FFI modules must be valid PureScript identifiers."
]
]
renderSimpleErrorMessage (DeprecatedFFIPrime mn ident) =
paras [ line $ "In the FFI module for " <> markCode (runModuleName mn) <> ":"
, indent . paras $
[ line $ "The identifier " <> markCode ident <> " contains a prime (" <> markCode "'" <> ")."
, line $ "Primes in identifiers exported from FFI modules are deprecated and won’t be supported in the future."
]
]
renderSimpleErrorMessage InvalidDoBind =
line "The last statement in a 'do' block must be an expression, but this block ends with a binder."
renderSimpleErrorMessage InvalidDoLet =
Expand Down
9 changes: 9 additions & 0 deletions src/Language/PureScript/Make/Actions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,11 @@ checkForeignDecls m path = do
js <- either (errorParsingModule . Bundle.UnableToParseModule) pure $ JS.parse jsStr path

foreignIdentsStrs <- either errorParsingModule pure $ getExps js

let deprecatedFFI = filter (any (== '\'')) foreignIdentsStrs
unless (null deprecatedFFI) $
warningDeprecatedForeignPrimes deprecatedFFI

foreignIdents <- either
errorInvalidForeignIdentifiers
(pure . S.fromList)
Expand Down Expand Up @@ -315,6 +320,10 @@ checkForeignDecls m path = do
errorInvalidForeignIdentifiers =
throwError . mconcat . map (errorMessage . InvalidFFIIdentifier mname . T.pack)

warningDeprecatedForeignPrimes :: [String] -> Make ()
warningDeprecatedForeignPrimes =
tell . mconcat . map (errorMessage' modSS . DeprecatedFFIPrime mname . T.pack)

parseIdents :: [String] -> Either [String] [Ident]
parseIdents strs =
case partitionEithers (map parseIdent strs) of
Expand Down
10 changes: 0 additions & 10 deletions tests/purs/passing/2172.purs

This file was deleted.

File renamed without changes.
56 changes: 56 additions & 0 deletions tests/purs/warning/DeprecatedFFIPrime.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
Error 1 of 4:

at tests/purs/warning/DeprecatedFFIPrime.purs:5:1 - 10:28 (line 5, column 1 - line 10, column 28)

In the FFI module for Main:

The identifier a' contains a prime (').
Primes in identifiers exported from FFI modules are deprecated and won’t be supported in the future.



See https://github.com/purescript/documentation/blob/master/errors/DeprecatedFFIPrime.md for more information,
or to contribute content related to this error.

Error 2 of 4:

at tests/purs/warning/DeprecatedFFIPrime.purs:5:1 - 10:28 (line 5, column 1 - line 10, column 28)

In the FFI module for Main:

The identifier b' contains a prime (').
Primes in identifiers exported from FFI modules are deprecated and won’t be supported in the future.



See https://github.com/purescript/documentation/blob/master/errors/DeprecatedFFIPrime.md for more information,
or to contribute content related to this error.

Error 3 of 4:

at tests/purs/warning/DeprecatedFFIPrime.purs:5:1 - 10:28 (line 5, column 1 - line 10, column 28)

In the FFI module for Main:

The identifier c' contains a prime (').
Primes in identifiers exported from FFI modules are deprecated and won’t be supported in the future.



See https://github.com/purescript/documentation/blob/master/errors/DeprecatedFFIPrime.md for more information,
or to contribute content related to this error.

Error 4 of 4:

at tests/purs/warning/DeprecatedFFIPrime.purs:5:1 - 10:28 (line 5, column 1 - line 10, column 28)

In the FFI module for Main:

The identifier d' contains a prime (').
Primes in identifiers exported from FFI modules are deprecated and won’t be supported in the future.



See https://github.com/purescript/documentation/blob/master/errors/DeprecatedFFIPrime.md for more information,
or to contribute content related to this error.

10 changes: 10 additions & 0 deletions tests/purs/warning/DeprecatedFFIPrime.purs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- @shouldWarnWith DeprecatedFFIPrime
-- @shouldWarnWith DeprecatedFFIPrime
-- @shouldWarnWith DeprecatedFFIPrime
-- @shouldWarnWith DeprecatedFFIPrime
module Main where

foreign import a' :: Number
foreign import b' :: Number
foreign import c' :: Number
foreign import d' :: Number