Skip to content

copilot-bluespec: Library contains trailing spaces #775

Closed

Description

@ivanperez-keera

Description

The module copilot-bluespec:Copilot.Compile.Bluespec.Expr contains trailing spaces. It's best to remove them, since those are automatically removed by many editors, leading to PRs containing changes unrelated to the main issues being addressed.

In compliance with our coding standard, trailing space should be removed.

Type

  • Bug: Code does not conform with our coding standards.

Additional context

None.

Requester

  • Ivan Perez.

Method to check presence of bug

The offending lines can be found with the following query:

$ grep -nIHre ' \+$' *
copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs:630:    -- Bluespec internally represents all IEEE floating-point values as structs 
copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs:634:    | isInfinite d = BS.CApply 
copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs:635:                       (BS.CVar $ BS.mkId BS.NoPos "infinity") 
copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs:637:                           then BS.CCon BS.idTrue [] 
copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs:640:                      
copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs:641:    | isNaN d      = let 
copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs:642:                       cexpr = BS.CHasType 
copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs:646:                                 ( BS.CQType [] $ BS.TCon $ 
copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs:647:                                     BS.TyCon 
copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs:648:                                       (BS.mkId BS.NoPos ctype) 
copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs:649:                                       Nothing 
copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs:652:                       cval = case ty of 
copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs:653:                         Float  -> fromIntegral $ 
copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs:655:                         Double -> fromIntegral $ 
copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs:658:                       ctype = case ty of 
copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs:663:    | d == 0       = BS.CApply 
copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs:664:                       (BS.CVar $ BS.mkId BS.NoPos "zero") 
copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs:665:                       [ if isNegativeZero d 
copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs:666:                           then BS.CCon BS.idTrue [] 
copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs:679:--  we need to convert NaN doubles safely into NaN floats. GHC Double2Float does not preserve signal nor payload 
copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs:682:uncastDoubleNaNToFloat nan = if (isSignaling nan) 
copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs:683:              then (setPayloadSignaling payload) 
copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs:685:              where 

Expected result

The result of the grep command above should be empty, indicating that no text files contain any trailing spaces.

Desired result

The result of the grep command above should be empty, indicating that no text files contain any trailing spaces.

Proposed solution

Remove all trailing spaces from any files that have them.

Further notes

None.

Activity

  1. added
    CR:Type:BugAdmin only: Change request pertaining to error detected
    CR:Status:InitiatedAdmin only: Change request that has been initiated
    on Oct 12, 2026
  2. ivanperez-keera commented on Oct 12, 2026

    @ivanperez-keera
    MemberAuthor

    Change Manager: Confirmed that the issue exists.

  3. added
    CR:Status:ConfirmedAdmin only: Change request that has been acknowledged by the change manager
    and removed
    CR:Status:InitiatedAdmin only: Change request that has been initiated
    on Oct 12, 2026
  4. ivanperez-keera commented on Oct 12, 2026

    @ivanperez-keera
    MemberAuthor

    Technical Lead: Confirmed that the issue should be addressed.

  5. added
    CR:Status:AcceptedAdmin only: Change request accepted by technical lead
    and removed
    CR:Status:ConfirmedAdmin only: Change request that has been acknowledged by the change manager
    on Oct 12, 2026
  6. ivanperez-keera commented on Oct 12, 2026

    @ivanperez-keera
    MemberAuthor

    Technical Lead: Issue scheduled for fixing in Copilot 4.8.2.

    Fix assigned to: @ivanperez-keera.

  7. added
    CR:Status:ScheduledAdmin only: Change requested scheduled
    and removed
    CR:Status:AcceptedAdmin only: Change request accepted by technical lead
    on Oct 12, 2026
  8. added this to the 4.8.2 milestone on Oct 12, 2026
  9. added
    CR:Status:ImplementationAdmin only: Change request that is currently being implemented
    and removed
    CR:Status:ScheduledAdmin only: Change requested scheduled
    on Oct 12, 2026
  10. ivanperez-keera commented on Oct 13, 2026

    @ivanperez-keera
    MemberAuthor

    Implementor: Solution implemented, review requested.

  11. added
    CR:Status:VerificationAdmin only: Change request that is currently being verified
    and removed
    CR:Status:ImplementationAdmin only: Change request that is currently being implemented
    on Oct 13, 2026
  12. ivanperez-keera commented on Oct 13, 2026

    @ivanperez-keera
    MemberAuthor

    Change Manager: Verified that:

    • Solution is implemented:
      • The code proposed compiles and passes all tests. Details:
        Build log: https://app.travis-ci.com/github/Copilot-Language/copilot/builds/278978739
      • The solution proposed produces the expected result. Details:
        The following Dockerfile checks that there are no files in all of Copilot with trailing spaces, after which it prints the message "Success":
        --- Dockerfile-verify-775
        FROM ubuntu:jammy
        
        WORKDIR /root
        SHELL ["/bin/bash", "-c"]
        
        ENV DEBIAN_FRONTEND=noninteractive
        RUN apt-get update
        
        RUN apt-get install --yes \
              git
        
        ARG GIT_COMMIT=HEAD
        ARG NAME=copilot
        ARG REPO=https://github.com/copilot-language/copilot
        
        RUN git clone ${REPO} ${NAME}
        RUN cd ${NAME} && git checkout ${GIT_COMMIT}
        
        WORKDIR ${NAME}
        
        RUN ! grep -nIHre ' \+$' *
        RUN echo "Success"
        Command (substitute variables based on new path after merge):
        $ docker build --build-arg "REPO=https://github.com/ivanperez-keera/copilot" --build-arg "NAME=copilot" --build-arg "GIT_COMMIT=78cdf022d05c422358782bcf19fe210d5d69188b" -t copilot-verify-775 -f Dockerfile-verify-775 .
        
    • Implementation is documented. Details:
      No updates needed; change is to formatting.
    • Change history is clear.
    • Commit messages are clear.
    • Changelogs are updated.
    • Examples are updated. Details:
      No updates needed; change is to formatting and does not affect existing examples.
    • Author is internal or has provided signed CLA.
    • Required version bumps are evaluated. Details:
      Bump not needed; change is to formatting and does not affect public API.
  13. ivanperez-keera commented on Oct 13, 2026

    @ivanperez-keera
    MemberAuthor

    Change Manager: Implementation ready to be merged.

  14. added
    CR:Status:ClosedAdmin only: Change request that has been completed
    and removed
    CR:Status:VerificationAdmin only: Change request that is currently being verified
    on Oct 13, 2026
  15. added a commit that references this issue on Oct 27, 2026
    afc233a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

CR:Status:ClosedAdmin only: Change request that has been completedCR:Type:BugAdmin only: Change request pertaining to error detected

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions