Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix compiler crash when a type operator is used in a type argument (#…
…4536) Add missing traversal branch for VisibleTypeApp in updateTypes
- Loading branch information
1 parent
5589e81
commit debfc2e
Showing
3 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* Fix compiler crash when a type operator is used in a type argument |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
module Main where | ||
|
||
import Prelude | ||
|
||
import Data.Maybe (Maybe(..)) | ||
import Data.Tuple.Nested ((/\), type (/\)) | ||
import Effect (Effect) | ||
import Effect.Console (log) | ||
import Type.Proxy (Proxy(..)) | ||
|
||
singleArgument :: forall @a. a -> Unit | ||
singleArgument _ = unit | ||
|
||
multiArgument :: forall @a @b. a -> b -> Unit | ||
multiArgument _ _ = unit | ||
|
||
singleApplication :: Int /\ Number -> Unit | ||
singleApplication = singleArgument @(Int /\ Number) | ||
|
||
-- Like expression applications, visible type applications are left-associative. | ||
-- This test accounts for subsequent type applications nested in this manner. | ||
appNestingWorks :: Int /\ Number -> Number /\ Int -> Unit | ||
appNestingWorks = multiArgument @(Int /\ Number) @(Number /\ Int) | ||
|
||
-- This test accounts for type applications nested within other AST nodes. | ||
otherNestingWorks :: Array (Maybe (Int /\ Number)) | ||
otherNestingWorks = [Just @(Int /\ Number) (0 /\ 0.0), Just @(Int /\ Number) (1 /\ 1.0)] | ||
|
||
type InSynonym = Int /\ Number | ||
|
||
-- This test accounts for type synonyms used as type arguments. | ||
-- Since expansion happens during checking, InSynonym would expand | ||
-- to an already-desugared type operator. This test exists for the | ||
-- sake of redundancy. | ||
inSynonym :: InSynonym -> Unit | ||
inSynonym = singleArgument @InSynonym | ||
|
||
-- This test accounts for type operators used as type arguments directly. | ||
operatorAsArgument :: Proxy (/\) | ||
operatorAsArgument = Proxy @(/\) | ||
|
||
main :: Effect Unit | ||
main = log "Done" |