Skip to content

Commit bd750ae

Browse files
Merge branch 'develop-remove-uninitialized'. Close #302.
**Description** The function `Copilot.Core.Type.Uninitialized.uninitialized` was deprecated in Copilot 3.6. The function was incomplete, and it was only used in one example, so what was needed from it was moved directly there. As per our internal policy of waiting 3 versions from deprecation until a public interface declaration can be removed, this type can now be removed completely. Since it is the only definition in the module `Copilot.Core.Type.Uninitialized`, the whole module can be removed. **Type** - Bug: unused code included in the implementation. **Additional context** - Issue: #270. **Requester** - Ivan Perez **Method to check presence of bug** The following expression finds imports of the module `Uninitialized`, ignoring appearances in comments or strings: ```sh $ grep -nHre 'Uninitialized' --include='*.hs' | grep -ve '^{-#' | grep -ve '--.*Uninitialized' | grep -ve '"[^"]*Uninitialized[^"]*"' copilot-core/src/Copilot/Core/Type/Uninitialized.hs:10:module Copilot.Core.Type.Uninitialized copilot-core/src/Copilot/Core.hs:33: , module Copilot.Core.Type.Uninitialized copilot-core/src/Copilot/Core.hs:45:import Copilot.Core.Type.Uninitialized ``` We use the module and not the function because a function with the same name is used in an example. The result obtained are three lines: the module, its re-import from `Copilot.Core`, and it being exported. The function `uninitliaized` is not required by Copilot's requirements, and therefore should not be published. A complete dockerfile follows: ``` 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 CMD git clone $REPO && cd $NAME && git checkout $COMMIT && set -x && grep -nHre '\<Uninitialized\>' --include='*.hs' | grep -ve '^{-#' | grep -ve '--.*Uninitialized' | grep -ve '"[^"]*Uninitialized[^"]*"' ``` It can be executed with: ``` $ docker run -e "REPO=<REPO_URL>" -e "NAME=<DIR>" -e "COMMIT=<TAG_BRANCH_OR_HASH>" -it copilot-verify-302 ``` **Expected result** The string returned by the script should now be empty (module does not exist). Running the docker image will show nothing if the module is not present (the script lists commands being executed): ``` HEAD is now at <TAG_BRANCH_OR_HASH>...<COMMIT_SUMMARY> + grep -nHre \<Uninitialized\> --include=*.hs + grep -ve ^{-# + grep -ve+ "[^"]*Uninitialized[^"]*" grep -ve --.*Uninitialized ``` **Solution implemented** The change implementation removes the module `Copilot.Core.Type.Uninitialized`, as well as its declaration from the cabal package, and its re-export from `Copilot.Core`. **Further notes** See a72543d for a confirmation of when the type was deprecated.
2 parents 50039ba + 1952c62 commit bd750ae

File tree

4 files changed

+2
-39
lines changed

4 files changed

+2
-39
lines changed

copilot-core/CHANGELOG

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
2022-04-07
1+
2022-04-08
2+
* Remove Copilot.Core.Type.Uninitialized. (#302)
23
* Remove Copilot.Core.Expr.Tag. (#304)
34

45
2022-03-07

copilot-core/copilot-core.cabal

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ library
6464
Copilot.Core.Type.Dynamic
6565
Copilot.Core.Type.Equality
6666
Copilot.Core.Type.Show
67-
Copilot.Core.Type.Uninitialized
6867
Copilot.Core.PrettyPrint
6968
Copilot.Core.PrettyDot
7069

copilot-core/src/Copilot/Core.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ module Copilot.Core
3030
, module Copilot.Core.Spec
3131
, module Copilot.Core.Type
3232
, module Copilot.Core.Type.Array
33-
, module Copilot.Core.Type.Uninitialized
3433
, module Data.Int
3534
, module Data.Word
3635
) where
@@ -42,6 +41,5 @@ import Copilot.Core.Operators
4241
import Copilot.Core.Spec
4342
import Copilot.Core.Type
4443
import Copilot.Core.Type.Array
45-
import Copilot.Core.Type.Uninitialized
4644
import Data.Int
4745
import Data.Word

copilot-core/src/Copilot/Core/Type/Uninitialized.hs

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)