Skip to content

Commit 50039ba

Browse files
Merge branch 'develop-remove-tag'. Close #304.
**Description** The type `Copilot.Core.Expr.Tag` was deprecated in Copilot 3.6 because it was not used and therefore did not belong in the program. 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. **Type** - Bug: unused code included in the implementation; a type declared does not have a complete API. **Additional context** - Issue: #260. **Requester** - Ivan Perez **Method to check presence of bug** The following expression finds uses of `Tag`, ignoring appearances in comments or strings. ```sh $ grep -nHre '\<Tag\>' --include='*.hs' | grep -ve '^{-#' | grep -ve '--.*Tag' | grep -ve '"[^"]*Tag[^"]*"' copilot-core/src/Copilot/Core/Expr.hs:15: , Tag copilot-core/src/Copilot/Core/Expr.hs:43:type Tag = Int ``` The result obtained are two lines: the definition, and it being exported. `Tag`s are 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 '\<Tag\>' --include='*.hs' | grep -ve '^{-#' | grep -ve '--.*Tag' | grep -ve '"[^"]*Tag[^"]*" ``` It can be executed with: ``` $ docker run -e "REPO=<REPO_URL>" -e "NAME=<DIR>" -e "COMMIT=<TAG_BRANCH_OR_HASH>" -it copilot-verify-304 ``` **Expected result** The string returned by the script should not be empty (no type exists). Running the docker image will show nothing after a message if the type is not present. ``` HEAD is now at <TAG_BRANCH_OR_HASH> ``` **Solution implemented** This change implementation removes that type declaration from the module `Copilot.Core.Expr`, as well as its export from the module's export list. **Further notes** See 0f536ec for a confirmation of when the type was deprecated.
2 parents 8202bac + c8f86d5 commit 50039ba

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

copilot-core/CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2022-04-07
2+
* Remove Copilot.Core.Expr.Tag. (#304)
3+
14
2022-03-07
25
* Version bump (3.8). (#298)
36
* Replaces uses of the internal Dynamic with base:Data.Dynamic. (#266)

copilot-core/src/Copilot/Core/Expr.hs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ module Copilot.Core.Expr
1212
, Expr (..)
1313
, UExpr (..)
1414
, DropIdx
15-
, Tag
1615
) where
1716

1817
import Copilot.Core.Operators (Op1, Op2, Op3)
@@ -38,12 +37,6 @@ type DropIdx = Word32
3837

3938
--------------------------------------------------------------------------------
4039

41-
-- | A unique tag for external arrays/function calls.
42-
{-# DEPRECATED Tag "The type Tag is deprecated in Copilot 3.6." #-}
43-
type Tag = Int
44-
45-
--------------------------------------------------------------------------------
46-
4740
-- | Internal representation of Copilot stream expressions.
4841
--
4942
-- The Core representation mimics the high-level Copilot stream, but the Core

0 commit comments

Comments
 (0)