"missing type for identifier" / expression's type changes, with weird combination of requires and eval
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 20/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Domain
- compilers
Research direction
Start with the supplied typed/racket reproduction at the REPL, focusing on the baz and bar modules, their begin-for-syntax blocks, eval call, and phase-shifted requires. Compare the first and repeated expressions, then the renamed-identifier and mylib/empty variants; done means repeated evaluations preserve the inferred type and no longer report a missing type for v or produce Any.
Written by the indexing model from the issue text.
Description
What version of Racket are you using?
6.9.0.1
What program did you run?
#lang typed/racket
(module baz racket/base
(require (for-syntax racket/base))
(begin-for-syntax
(eval '0
(module->namespace 'racket/private/sc))))
(module bar
racket/base
(require (for-meta -2 (submod ".." baz))
;; Bug also occurs with typed/racket/no-check here:
(for-syntax typed/racket)))
;; Main module:
(require (for-syntax 'bar))
;; At the REPL of the main module:
#;(let ([v 1]) v) ;; First try works
#;(let ([v 1]) v) ;; Error on second try
;; Type Checker: missing type for identifier;
;; consider adding a type annotation with `:'
;; identifier: v in: v
Splitting the file into several separate files still triggers the bug (but if I try to inline the require statements from bar into foo, shifting everything one meta-level up, then the bug stops occurring). If the second try renames v to w, then it works fine, but later uses of v or w trigger this bug.
If I use my type-expander in module bar, then I can trigger a slightly different bug: the type of the result of ((λ #:∀ (A) (x) x) 1) is Integer on the first try, and becomes Any on the second and later tries. If the second try renames x to t, then it works fine, but later uses of x or y trigger this bug.
#lang typed/racket
(module baz racket/base
(require (for-syntax racket/base)
(for-meta 2 racket/base))
(begin-for-syntax
(begin-for-syntax
(eval '0
(module->namespace 'racket/private/sc)))))
(module bar type-expander/lang
(require (for-meta -2 (submod ".." baz))))
;; Main module:
(require 'bar)
;; At the REPL of the main module:
#;((λ #:∀ (A) (x) x) 1) ;; Type: Integer
#;((λ #:∀ (A) (x) x) 1) ;; Type: Any
;; More meaningful example of usage:
#;(let #:∀ (A ...) ([v : (List (Pairof Any A) ...) (list '(0 . 1))]) v) ;; (List (Pairof Zero One))
#;(let #:∀ (A ...) ([v : (List (Pairof Any A) ...) (list '(0 . 1))]) v) ;; (List (Pairof Any One))
Note that these bugs do not depend on the use of racket/private/sc. If I change it to mylib/empty, where the empty.rkt only contains (module quux '#%kernel), the bugs still occur.
- Dominant language
- Racket
- Stars
- 575
- Forks
- 106
- Avg merge
- 2h 1m
- Merged PRs (30d)
- 2
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from racket/typed-racket
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
racket/typed-racket#1512 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
racket/typed-racket#1505 · 13 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
racket/typed-racket#1516 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
racket/typed-racket#1506 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
racket/typed-racket#1493 · 1 comment ·
All issues in racket/typed-racket
Similar issues
-
mlir
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
llvm/llvm-project#224908 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
area-CodeGen-coreclr untriaged
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
secondlife/sl-vscode-plugin#147 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
objectionary/phie#149 ·