-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop-core-lowerCamelCase'. Close #457.
**Description** To comply with our NASA Class D requirements, our code must abide by a style guide. This is the third issue pertaining to style changes for conformance with Class D within `copilot-core`. We focus only on `copilot-core` to limit the size of the issue. **Type** - Management: conformance with new requirement. **Additional context** - See issues 332 and 316 for other style changes addressed in `copilot-core`. **Requester** - Ivan Perez **Method to check presence of bug** The following Dockerfile checks that each of the functions in question have been deprecated, in which case it prints the message Success: ``` FROM ubuntu:trusty RUN apt-get update RUN apt-get install --yes software-properties-common RUN add-apt-repository ppa:hvr/ghc RUN apt-get update RUN apt-get install --yes ghc-8.6.5 cabal-install-2.4 RUN apt-get install --yes libz-dev ENV PATH=/opt/ghc/8.6.5/bin:/opt/cabal/2.4/bin:$PWD/.cabal-sandbox/bin:$PATH RUN cabal update RUN cabal v1-sandbox init RUN cabal v1-install alex happy RUN apt-get install --yes git SHELL ["/bin/bash", "-c"] CMD git clone $REPO && cd $NAME && git checkout $COMMIT && cd .. \ && cabal v1-install copilot/copilot-core/ \ && ! cabal v1-exec -- runhaskell -Wall -Werror=deprecations <<< "import Copilot.Core.Type(typename,Struct); t :: Struct a => a -> String ; t = typename; main :: IO (); main = return ()" \ && ! cabal v1-exec -- runhaskell -Wall -Werror=deprecations <<< "{-# LANGUAGE DataKinds #-}; import Copilot.Core.Type(tylength, Type); import Copilot.Core.Type.Array(Array); t :: Type (Array 3 Bool) -> Int ; t = tylength; main :: IO (); main = return ()" \ && ! cabal v1-exec -- runhaskell -Wall -Werror=deprecations <<< "{-# LANGUAGE DataKinds #-}; import Copilot.Core.Type(tysize, Type); import Copilot.Core.Type.Array(Array); t :: Type (Array 3 Bool) -> Int ; t = tysize; main :: IO (); main = return ()" \ && ! cabal v1-exec -- runhaskell -Wall -Werror=deprecations <<< "import GHC.TypeLits(KnownSymbol); import Copilot.Core.Type(fieldname, Field); t :: KnownSymbol s0 => Field s0 t0 -> String; t = fieldname; main :: IO (); main = return ()" \ && ! cabal v1-exec -- runhaskell -Wall -Werror=deprecations <<< "import GHC.TypeLits(KnownSymbol); import Copilot.Core.Type(Field, Struct, accessorname); t :: (Struct a0, KnownSymbol s0) => (a0 -> Copilot.Core.Type.Field s0 t0) -> String; t = accessorname; main :: IO (); main = return ()" \ && ! cabal v1-exec -- runhaskell -Wall -Werror=deprecations <<< "import Copilot.Core.Type.Array(arrayelems); t = arrayelems; main :: IO (); main = return ()" \ && echo "Success" ``` Command (substitute variables based on new path after merge): ```sh $ docker run -e "REPO=https://github.com/copilot-language/copilot" -e "NAME=copilot" -e "COMMIT=<commit_hash>" copilot-verify-457 ``` **Expected result** All Copilot Core code conforms to the following rules: - Variable and function names should be lowerCamelCase. Running the docker file above prints the message Success, indicating that, for all functions identified as non-conforming with the style guide, importing them (and using them) results in an error. **Solution implemented** Deprecate `Copilot.Core.Type.typename`, `Copilot.Core.Type.tylength`, `Copilot.Core.Type.tysize`, `Copilot.Core.Type.fieldname`, `Copilot.Core.Type.accessorname`, `Copilot.Core.Type.Array.arrayelems`, and define corresponding functions with lowerCamelCase names. Update all uses across all of copilot to match the new function names. **Further notes** These changes are public facing, they affect functions that are part of the API. We follow the deprecation policy for them. In the docker file, we have to use the functions or GHC will not actually report an error. In some cases, using them, even if just to define a synonym for them (one of the simplest ways to use them), requires substantial boilerplate (signatures, additional imports, extensions, etc).
- Loading branch information
Showing
18 changed files
with
94 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
2023-11-05 | ||
* Compliance with style guide. (#457) | ||
|
||
2023-09-07 | ||
* Version bump (3.16.1). (#455) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
2023-11-05 | ||
* Replace uses of deprecated functions. (#457) | ||
|
||
2023-09-07 | ||
* Version bump (3.16.1). (#455) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
2023-11-05 | ||
* Replace uses of deprecated functions. (#457) | ||
|
||
2023-09-07 | ||
* Version bump (3.16.1). (#455) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
2023-11-05 | ||
* Replace uses of deprecated functions. (#457) | ||
|
||
2023-11-03 | ||
* Fix typo in README. (#459) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.