Change Module-Path to be union type instead of a Base type. Closes PR 11963.

This commit is contained in:
Eric Dobson 2011-06-22 17:29:59 -04:00 committed by Sam Tobin-Hochstadt
parent 3fad39b53a
commit 4241557543
4 changed files with 25 additions and 2 deletions

View File

@ -0,0 +1,12 @@
#;
(
TR opt: module-path.rkt 12:0 (unless (module-path? 2) #f) -- dead then branch
#t
#f
#f
)
#lang typed/racket #:optimize
(if (module-path? "a") #t #f)
(if (module-path? "\0") #t #f)
(unless (module-path? 2) #f)

View File

@ -1582,7 +1582,8 @@
[resolved-module-path? (make-pred-ty -Resolved-Module-Path)]
[make-resolved-module-path (-> (Un -Symbol -Path) -Resolved-Module-Path)]
[resolved-module-path-name (-> -Resolved-Module-Path (Un -Path -Symbol))]
[module-path? (make-pred-ty -Module-Path)]
[module-path? (asym-pred Univ B (-FS (-filter -Module-Path 0) -top))]
[current-module-name-resolver (-Param (cl->* (-Resolved-Module-Path . -> . Univ)
((Un -Module-Path -Path)
(-opt -Resolved-Module-Path)

View File

@ -157,7 +157,6 @@
(define -Char (make-Base 'Char #'char? char? #'-Char))
(define -Thread (make-Base 'Thread #'thread? thread? #'-Thread))
(define -Resolved-Module-Path (make-Base 'Resolved-Module-Path #'resolved-module-path? resolved-module-path? #'-Resolved-Module-Path))
(define -Module-Path (make-Base 'Module-Path #'module-path? module-path? #'-Module-Path))
(define -Module-Path-Index (make-Base 'Module-Path-Index #'module-path-index? module-path-index? #'-Module-Path-Index))
(define -Compiled-Module-Expression (make-Base 'Compiled-Module-Expression #'compiled-module-expression? compiled-module-expression? #'-Compiled-Module-Expression))
(define -Prompt-Tag (make-Base 'Prompt-Tag #'continuation-prompt-tag? continuation-prompt-tag? #'-Prompt-Tag))

View File

@ -86,3 +86,14 @@
(define Ident (-Syntax -Symbol))
(define -Module-Path (*Un -Symbol -String
(-lst* (-val 'quote) -Symbol)
(-lst* (-val 'lib) -String)
(-lst* (-val 'file) -String)
(-pair (-val 'planet)
(*Un (-lst* -Symbol)
(-lst* -String)
(-lst* -String (-lst* -String -String #:tail (make-Listof (*Un -Nat (-lst* (*Un -Nat (one-of/c '= '+ '-)) -Nat)))))))))