git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Handle TypeLevelString when checking orphans (#2393)

* Handle TypeLevelString when checking orphans A TypeLevelString by itself can never determine orphan-ness. Similar to how a TypeVar by itself cannot determine orphan-ness. * Glob for Lib.purs in extra-source-files

commita8756f0ffe39dce9f67438f193bc93fb44f7acde authorHardy Jones <jones3.hardy@gmail.com> dateFri 21 Oct 2016, 19:56 (10 years ago) parentda83efb
5 files changed+20
examples/failing/2378.purs+6 examples/failing/2378/Lib.purs+3 examples/passing/2378.purs+9 purescript.cabal+1 src/Language/PureScript/TypeChecker.hs+1
examples/failing/2378.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith OrphanInstance
2+module Main where
3+
4+import Lib
5+
6+instance fooX :: Foo "x"
examples/failing/2378/Lib.pursnew file+3
@@ -0,0 +1,3 @@
1+module Lib (class Foo) where
2+
3+class Foo (a :: Symbol)
examples/passing/2378.pursnew file+9
@@ -0,0 +1,9 @@
1+module Main where
2+
3+import Control.Monad.Eff.Console (log)
4+
5+class Foo (a :: Symbol)
6+
7+instance fooX :: Foo "x"
8+
9+main = log "Done"
purescript.cabal+1
@@ -55,6 +55,7 @@ extra-source-files: examples/passing/*.purs
5555 , examples/passing/TypeWithoutParens/*.purs
5656 , examples/failing/*.purs
5757 , examples/failing/1733/*.purs
58+ , examples/failing/2378/*.purs
5859 , examples/failing/ConflictingExports/*.purs
5960 , examples/failing/ConflictingImports/*.purs
6061 , examples/failing/ConflictingImports2/*.purs
src/Language/PureScript/TypeChecker.hs+1
@@ -312,6 +312,7 @@ typeCheckAll moduleName _ = traverse go
312312 where
313313 checkType :: Type -> Bool
314314 checkType (TypeVar _) = False
315+ checkType (TypeLevelString _) = False
315316 checkType (TypeConstructor (Qualified (Just mn'') _)) = moduleName == mn''
316317 checkType (TypeConstructor (Qualified Nothing _)) = internalError "Unqualified type name in checkOrphanInstance"
317318 checkType (TypeApp t1 _) = checkType t1