Commit Graph

39259 Commits

Author SHA1 Message Date
Matthew Flatt
f2a7405dda syntax/moddep: DAG repair and #:show argument 2018-08-09 10:11:40 -06:00
Ryan Culpepper
088f72c8c5 syntax/parse: parse syntax-class patterns just once; closes #2164
In pass 1, syntax class defns (without #:attributes decl) need to parse
patterns to determine exported attributes. But to allow forward refs,
stxclass references are not resolved until pass 2.

Previously, this was done by just reparsing patterns in pass 2. But that
means pattern expanders get expanded twice, and their expansions might
not agree (eg generate-temporaries). So instead, parse in pass 1, insert
"fixup" patterns to delay stxclass resolution, and resolve fixups in pass 2.
Complication: a fixup pattern is assumed S, but can change to H in pass 2.
2018-08-09 14:37:33 +02:00
Ryan Culpepper
dbfb1e2fe8 syntax/parse: add datum-to-expression helper 2018-08-09 14:37:33 +02:00
Ryan Culpepper
d950049c5a syntax/parse: trim internal provides 2018-08-09 14:37:33 +02:00
Ryan Culpepper
8a4bab5c3e minimatch: add match-lambda 2018-08-09 14:37:33 +02:00
Ryan Culpepper
34e7c8f556 syntax/parse: only collect attrs with interned names 2018-08-09 14:37:33 +02:00
Leif Andersen
7fc309c524
Add link from protect-out to protecting exports page. (#2221) 2018-08-08 16:08:16 -04:00
shhyou
b2829078ee Fix build[-*]-contract-property contract in docs 2018-08-08 12:51:14 -05:00
shhyou
0c8c643989 Fix default fallback for contract-struct-generate
The actual problem is that build-chaperone-contract-property
exported to the user defaults #:exercise and #:generate
to false. This commit changes the default fallback value
in the case where #:generate is not a procedure instead
of changing build-chaperone-contract-property directly
to stay consistent with the how contract-struct-exercise
currently does it.
2018-08-08 12:51:14 -05:00
shhyou
aeab2420fa Fix default contract generation and exercise proc
The default values updated in commit ffc5720b5 do
not work for very subtle reasons. In build-contract
in racket/contract/private/prop, the default values
should not accept an extra ctc argument since ctc
is already handled by make-flat-contract. The
default gen procedure should also be (λ (fuel) #f)
instead of (λ (ctc) (λ () #f)) since the latter
would generate false when the generation should
have failed. In build-property, the default procedure
(λ (ctc) (λ (fuel) #f)) is correct and should not
be changed to (λ (ctc) (λ () #f)).
2018-08-08 12:51:14 -05:00
Ben Greenman
59f49cb6ff
doc: index the character constants
add character constants (`#\newline`, etc.) to the index
2018-08-08 11:56:34 -04:00
shhyou
43b0cd4a7e Initialize fail-escape in contract-exercise
Some exercise procedure might invoke
contract-random-generate/choose, therefore
fail-escape needs to be initialized.
2018-08-07 10:06:28 -05:00
Matthew Flatt
5ba910d143 read-bytes!: avoid integer overflow in read size
Closes #2211
2018-08-06 20:43:04 -06:00
shuhung
b4e44e71a9 Export contract-random-generate-env? 2018-08-06 12:55:38 -05:00
Ben Greenman
aae08c48ee
doc: stx-trans.scrbl edits and examples (#2200)
- `local-expand` : replace ambiguous comma with an english word, to clarify
- `syntax-local-value` : replace '@emph{Unlike}` with `Unlike`, because the
   extra emphasis was overall distracting to me
- `syntax-local-value/immediate` : add example
- `syntax-local-introduce` : add example
- replace a few `and/c` with `syntax/c`
2018-08-05 23:54:29 -04:00
Ben Greenman
2ef8d60cc6
improve hash-ref error message for non-thunk failure procedure (#2204)
Improve the `hash-ref` error message when the failure result does not
accept zero arguments. (This only changes what the error messages says.)

Example:
```(hash-ref #hash() 'a add1)```

Old message:
```
; add1: arity mismatch;
;  the expected number of arguments does not match the given number
;   expected: 1
;   given: 0
```

New message:
```
; hash-ref: contract violation
;   expected: (-> any)
;   given: #<procedure:add1>
;   argument position: 3rd
```
2018-08-05 23:53:49 -04:00
Philip McGrath
3e6846a8d9 typo: "unintialized" -> "uninitialized" (#2209) 2018-08-05 23:53:21 -04:00
Matthias Felleisen
8deaa4cf91
fixing bad error message for assf
The old error message requested a function of 2 arguments while the quasi-contract demands one of 1 argument.
2018-08-05 17:48:17 -04:00
Matthew Flatt
582e85adf7 support Visual Studio 2017
Requires the Windows 8 SDK for now, I think.
2018-08-05 13:44:48 -07:00
Matthew Flatt
df67d4e9d1 expander: fix problem with define shadowing require
When a `define` that shadows a `require` appears before the `require`,
then the `require` may fail to other, non-shadowed bindings from the
same `require` spec.

Thanks to Matthias for reporting the problem.
2018-08-05 13:46:38 -06:00
shhyou
33b94e6558 Exercise application result in -> contract 2018-08-05 12:57:32 -05:00
Matthew Flatt
d8ea41df23 cs: fix malloc argument parsing
Closes #2207
2018-08-03 06:58:15 -06:00
Robby Findler
258160707f use slightly better language so it makes sense with the swapping that
the error messages do based on positive/negative

inspired by #2205
2018-08-02 13:34:22 -05:00
Alex Knauth
6cc3a2f960
fix typo, stream-empty? -> set-empty? (#2191)
* fix typo, stream-empty? -> set-empty?

* add a regression test for the set->stream fallback
2018-08-01 13:14:05 -04:00
Matthew Flatt
a0ca6d6489 doc correction
Corrects a missed update from moving text form Inside to Foreign.
2018-07-31 10:14:08 -06:00
Matthew Flatt
b7392a688e hash-iterate-value & co.: add an optional bad-index result
The new argument to `hash-iterate-value` and most other
`...-hash-iterate-...` functions determines a result to be returned in
place of raising a "bad index" exception.

For most kinds of hash tables, a "bad index" exception will only
happen when the provided index is wrong or when a hash table is
mutated during an iteration. Mutation during iteration is generally a
bad idea, but in the case of a weak hash table, a potential background
mutation by the garbage collector is difficult to suppress or ignore.
Adding an option to control bad-index behavior makes it easier to
write loops that defend against uncooperative tables, including loops
where a hash-table key disappears asynchronously.

Racket's printer was already using this functionality internally, so
the change to `hash-iterate-value` and company mostly exposes existing
functionality.

The `in-hash` form and related sequence constructors similarly support
a bad-index alternate value so iterations can handle that case
explicitly. They do not use the new bad-index support implicitly to
skip missing entries, because that idea does not play well with the
iteration API. A hash-table index can go bad after `in-hash` has
selected the index and determined that it should be used for the next
iteration, and a sequence can't take back that decision.
2018-07-31 10:14:07 -06:00
Matthew Flatt
5526113311 cs: fix some problems with hash tables
In part, the corrections rely on a new `hashtable-cells` procedure
in Chez Scheme.
2018-07-30 17:37:23 -06:00
Matthew Flatt
fcd84113c8 cs: fix impersonator-property accessor failure modes 2018-07-30 07:46:57 -06:00
Matthew Flatt
bb4e7df1c6 cs: fix case of vector-copy! 2018-07-30 07:34:36 -06:00
Matthew Flatt
810d6da3c8 cs: unbreak continuation-mark chaperones 2018-07-30 07:02:59 -06:00
Matthew Flatt
d9ec0705cf add ffi/unsafe/collect-callback
The `ffi/unsafe/collect-callback` library exposes functionality
formerly only available via Racket's C interface, but implement
it for both Racket and RacketCs.
2018-07-29 13:32:44 -06:00
Matthew Flatt
f8297f9c00 thread: fix resume of suspended sync 2018-07-29 09:59:12 -06:00
Matthew Flatt
e066bb44ea repair uninterrupted-exit on continuation application 2018-07-29 07:18:27 -06:00
Matthew Flatt
d0f73f5ea8 option for benchmark tabulate to tag R5RS benchmarks 2018-07-29 06:41:40 -06:00
Matthew Flatt
1b716d5d32 schemify: fix inlining issues
Make `map` inline again, which involves optimizing away

 (variable-reference-from-unsafe? (#%variable-reference))

early enough. Fix post-schemify optimization for `procedure?
by adding both forms of an import name to the `imports` table.
Fix a problem with inlining operations passed to an inlined
function (as reflected by the addition of `find-known+import`).
2018-07-28 15:07:37 -06:00
Matthew Flatt
fa93b55108 make benchmark driver work right with racketcs 2018-07-28 15:07:37 -06:00
yjqww6
759c71e158 fix a broken pattern-expander example (#2197)
pattern expanders shouldn't use `syntax-protect` on their results, and so they shouldn't use `syntax-rules`
2018-07-28 12:18:40 -04:00
Matthew Flatt
a447b5bf6b expander: improve some errors at phase >= 1
At phase 1 and higher, the expander tentatively allows an unbound
identifier so that, for example, `define-for-syntax` can define a
helper function syntactically after a compile-time expression that
uses the helper. While unbound references eventually trigger an error,
the reordering can be consuing, as in the example

  #lang racket

  (define-syntax (f stx)
    (syntax-parse stx
      [(_ oops) #'ok]))

which complains about `_` when the real problem is that `syntax-parse`
isn't imported.

To provide better errors, `raise-syntax-error` now implicitly extends
an error message to include a list of previously encountered unbound
identifiersin the current compilation unit. That list will be
non-empty only at phase >= 1. With that change, the error message for the
above example is

 bad.rkt:5:5: _: wildcard not allowed as an expression
  after encountering unbound identifier (which is possibly the real problem):
   syntax-parse
  in: (_ oops)
  ....

Closes #2167
2018-07-27 12:29:59 -06:00
Matthew Flatt
031564b28c expander extract: add --local-rename to minimize startup diffs
The expander's output normally uses a distinct symbolic name for every
distinct binding within a linklet. That property is useful for
consumers like schemify, but it's counterproductive for minimizing the
diff in changes to "startup.inc", since the traditional Racket
compiler doesn't need that guarantee. Use `--local-rename` to generate
"startup.inc", which should make future diffs smaller and more
composable after changes to the expander.
2018-07-27 12:29:59 -06:00
Alex Knauth
f4f22404b3
syntax-parse docs: small examples for #:with, #:attr, #:fail-when, and #:fail-unless (#2185)
* small examples for #:with, #:attr, #:fail-when, and #:fail-unless

* add pattern-directive keywords to doc-index
2018-07-27 11:45:46 -04:00
Leif Andersen
cb0d79a8ae
Ignore this PR (#2189)
Fix bug in serialize test

/ -> root dir

On windows `/` isn't enough to make a complete path.
2018-07-26 14:52:31 -04:00
Matthew Flatt
0b9a7587f6 expander/flatten: better help, error reporting, and - mode for ++knot 2018-07-25 21:27:36 -06:00
Matthew Flatt
a41f58f9d7 cs: use call-setting-continuation-attachment 2018-07-25 19:32:29 -06:00
Matthew Flatt
60977b36c7 cs: remove useless call in delimiting continuations 2018-07-25 16:28:07 -06:00
Ben Greenman
68a83680e0 doc: remove duplicate index entry
Remove the second index entry for `'not-free-identifier=?`
2018-07-24 17:28:28 -04:00
myfreeweb
c7c4efca95 Add FreeBSD/aarch64 platform 2018-07-24 13:14:22 -06:00
Ben Greenman
4c672a5b6a typo: 'orig-d' -> 'orig-id' 2018-07-23 22:56:18 -04:00
Ben Greenman
e97717ef2b pkg new: clarify 'module+ main' and 'module+ test' purpose
- edit the comments, thanks to John B Clements and Alex Gian and Alex McLin
  and Phil McGrath
- add simple example code
2018-07-22 00:23:33 -04:00
Leif Andersen
eaaede9c2c
Fix fasl bug in Racket 7.0 beta! (#2178)
* Fix fasl bug in Racket 7.0 beta

The following program causes racket to error in Racket 7.

(parameterize ([current-write-relative-directory (build-path "/" "a")])
  (s-exp->fasl (build-path "/")))

This bug appears to have been introduced in Racket 7, and not in
Racket 6.x.

* Fix another bug where 'same was put through path-element->bytes

* "/" => (car (root-paths-list))

This is for windows where simply "/" is not a complete path.

* Add similar tests to serialize library.

* Better error message when relative-directory is a bad pair

Before it would give an internal list-tail error, now it returns
a proper bad argument error.

* Better tests, and improved common case
2018-07-21 14:46:44 -04:00
Gustavo Massaccesi
ebb7c0ea82 cs: fix mark-table-prune
Fix the case when the list of marks to remove is empty,
and also change the order of the arguments.
2018-07-20 17:50:24 -03:00