Compare commits

..

1 Commits

Author SHA1 Message Date
Sam Tobin-Hochstadt
e0cc0cd65e Handle Integer instead of Fixnum for hash-code computation.
Now that these are type checked by Typed Racket in 7.5, it's a
problem that the documentation doesn't promise that these will be a
Fixnum. Switch to using Integer, and change the use of fxxor to
match.
2019-11-06 13:27:58 -05:00
9 changed files with 28 additions and 36 deletions

View File

@ -8,32 +8,24 @@ env:
- PATH="$RACKET_DIR/bin:$PATH" - PATH="$RACKET_DIR/bin:$PATH"
matrix: matrix:
# RACKET_VERSION is an argument to install-racket.sh # RACKET_VERSION is an argument to install-racket.sh
- RACKET_VERSION=7.0 COVER=true - RACKET_VERSION=6.6
- RACKET_VERSION=7.1 COVER=true - RACKET_VERSION=6.7
- RACKET_VERSION=7.2 COVER=true - RACKET_VERSION=6.8
- RACKET_VERSION=7.3 COVER=true - RACKET_VERSION=RELEASE
- RACKET_VERSION=7.4 COVER=true - RACKET_VERSION=HEAD
- RACKET_VERSION=7.5 COVER=true
- RACKET_VERSION=7.6 COVER=true
- RACKET_VERSION=7.7 COVER=true
- RACKET_VERSION=7.8 COVER=true
- RACKET_VERSION=7.9 COVER=true
- RACKET_VERSION=8.0 COVER=true
- RACKET_VERSION=8.0 COVER=true RACKET_CS=1
- RACKET_VERSION=HEAD COVER=true
before_install: before_install:
- curl -L https://raw.githubusercontent.com/greghendershott/travis-racket/master/install-racket.sh | bash - curl -L https://raw.githubusercontent.com/greghendershott/travis-racket/master/install-racket.sh | bash
- if $COVER; then raco pkg install --deps search-auto doc-coverage cover cover-codecov; fi # or cover-coveralls - raco pkg install --deps search-auto doc-coverage cover cover-codecov # or cover-coveralls
install: install:
- raco pkg install --deps search-auto -j 1 phc-adt/ phc-adt-doc/ phc-adt-lib/ phc-adt-test/ - raco pkg install --deps search-auto -j 2 phc-adt/ phc-adt-doc/ phc-adt-lib/ phc-adt-test/
script: script:
- raco test -r -p phc-adt phc-adt-doc phc-adt-lib phc-adt-test - raco test -r -p phc-adt phc-adt-doc phc-adt-lib phc-adt-test
- raco setup --check-pkg-deps --no-zo --no-launcher --no-install --no-post-install --no-docs --pkgs phc-adt phc-adt-doc phc-adt-lib phc-adt-test - raco setup --check-pkg-deps --no-zo --no-launcher --no-install --no-post-install --no-docs --pkgs phc-adt phc-adt-doc phc-adt-lib phc-adt-test
- if $COVER; then raco doc-coverage phc-adt; fi - raco doc-coverage phc-adt
- if $COVER; then raco cover -s main -s test -s doc -f codecov -f html -d ~/coverage . || true; fi - raco cover -s main -s test -s doc -f codecov -f html -d ~/coverage . || true
# TODO: add an option to cover to run the "outer" module too, not just the submodules. # TODO: add an option to cover to run the "outer" module too, not just the submodules.
# TODO: deploy the coverage info. # TODO: deploy the coverage info.
# #

View File

@ -1,5 +1,5 @@
[![Build Status,](https://img.shields.io/travis/jsmaniac/phc-adt/main.svg)](https://travis-ci.org/jsmaniac/phc-adt) [![Build Status,](https://img.shields.io/travis/jsmaniac/phc-adt/master.svg)](https://travis-ci.org/jsmaniac/phc-adt)
[![Coverage Status,](https://img.shields.io/codecov/c/github/jsmaniac/phc-adt/main.svg)](https://codecov.io/gh/jsmaniac/phc-adt) [![Coverage Status,](https://img.shields.io/codecov/c/github/jsmaniac/phc-adt/master.svg)](https://codecov.io/gh/jsmaniac/phc-adt)
[![Build Stats,](https://img.shields.io/badge/build-stats-blue.svg)](http://jsmaniac.github.io/travis-stats/#jsmaniac/phc-adt) [![Build Stats,](https://img.shields.io/badge/build-stats-blue.svg)](http://jsmaniac.github.io/travis-stats/#jsmaniac/phc-adt)
[![Online Documentation,](https://img.shields.io/badge/docs-online-blue.svg)](http://docs.racket-lang.org/phc-adt/) [![Online Documentation,](https://img.shields.io/badge/docs-online-blue.svg)](http://docs.racket-lang.org/phc-adt/)
[![Maintained as of 2017,](https://img.shields.io/maintenance/yes/2017.svg)](https://github.com/jsmaniac/phc-adt/issues) [![Maintained as of 2017,](https://img.shields.io/maintenance/yes/2017.svg)](https://github.com/jsmaniac/phc-adt/issues)

View File

@ -22,4 +22,4 @@
"datatype")) "datatype"))
(define pkg-desc "Algebraic Datatypes tailored for writing compilers (documentation only)") (define pkg-desc "Algebraic Datatypes tailored for writing compilers (documentation only)")
(define version "1.1") (define version "1.1")
(define pkg-authors '(|Suzanne Soy|)) (define pkg-authors '("Georges Dupéron"))

View File

@ -1,7 +1,7 @@
#lang scribble/manual #lang scribble/manual
@title{Algebraic Data Types for compilers: Implementation} @title{Algebraic Data Types for compilers: Implementation}
@author[@author+email["Suzanne Soy" "racket@suzanne.soy"]] @author[@author+email["Georges Dupéron" "georges.duperon@gmail.com"]]
This library is implemented using literate programming. The implementation This library is implemented using literate programming. The implementation
details are presented in the following sections. The user documentation is in details are presented in the following sections. The user documentation is in

View File

@ -22,4 +22,4 @@
"scribble-math")) "scribble-math"))
(define pkg-desc "Algebraic Datatypes tailored for writing compilers (tests are in phc-adt-test)") (define pkg-desc "Algebraic Datatypes tailored for writing compilers (tests are in phc-adt-test)")
(define version "1.1") (define version "1.1")
(define pkg-authors '(|Suzanne Soy|)) (define pkg-authors '("Georges Dupéron"))

View File

@ -104,10 +104,10 @@ same if the @tc[database] and @tc[index] is the same for both nodes.
(eq? (raw-node-database a) (raw-node-database b)) (eq? (raw-node-database a) (raw-node-database b))
(equal? (raw-node-index a) (raw-node-index b)))) (equal? (raw-node-index a) (raw-node-index b))))
(λ (a r) (λ (a r)
(bitwise-xor (eq-hash-code (raw-node-database a)) (fxxor (eq-hash-code (raw-node-database a))
(r (raw-node-index a)))) (r (raw-node-index a))))
(λ (a r) (λ (a r)
(bitwise-xor (eq-hash-code (raw-node-database a)) (fxxor (eq-hash-code (raw-node-database a))
(r (raw-node-index a)))))] (r (raw-node-index a)))))]
The following function can then be used to test if two nodes are the same, based The following function can then be used to test if two nodes are the same, based
@ -276,8 +276,8 @@ versions of this library may use more sophisticated mechanisms.
@chunk[<combine-hash-codes> @chunk[<combine-hash-codes>
(: combine-hash-codes ( Integer * Integer)) (: combine-hash-codes ( Integer * Integer))
(define (combine-hash-codes . hashes) (define (combine-hash-codes . fixnums)
(apply bitwise-xor hashes))] (apply bitwise-xor fixnums))]
@subsection{Caching node equality} @subsection{Caching node equality}

View File

@ -235,11 +235,11 @@ nodes have the same shape, but cannot by themselves create logical cycles.
#t)) #t))
(λ (a rec-hash) (λ (a rec-hash)
(bitwise-xor (rec-hash 'id) (fxxor (rec-hash 'id)
(rec-hash (force ((struct-accessor pid fieldᵢ) a))) (rec-hash (force ((struct-accessor pid fieldᵢ) a)))
)) ))
(λ (a rec-hash) (λ (a rec-hash)
(bitwise-xor (rec-hash 'id) (fxxor (rec-hash 'id)
(rec-hash (force ((struct-accessor pid fieldᵢ) a))) (rec-hash (force ((struct-accessor pid fieldᵢ) a)))
))))] ))))]

View File

@ -11,4 +11,4 @@
(define build-deps '()) (define build-deps '())
(define pkg-desc "Tests for the phc-adt library") (define pkg-desc "Tests for the phc-adt library")
(define version "1.1") (define version "1.1")
(define pkg-authors '(|Suzanne Soy|)) (define pkg-authors '("Georges Dupéron"))

View File

@ -9,4 +9,4 @@
(define build-deps '()) (define build-deps '())
(define pkg-desc "Algebraic Datatypes tailored for writing compilers") (define pkg-desc "Algebraic Datatypes tailored for writing compilers")
(define version "1.1") (define version "1.1")
(define pkg-authors '(|Suzanne Soy|)) (define pkg-authors '("Georges Dupéron"))