[Git][ghc/ghc][wip/junit-fixes] More backwards compat hackery

Ben Gamari gitlab at gitlab.haskell.org
Sat Jun 22 01:06:52 UTC 2019



Ben Gamari pushed to branch wip/junit-fixes at Glasgow Haskell Compiler / GHC


Commits:
69bd9f2e by Ben Gamari at 2019-06-22T01:06:43Z
More backwards compat hackery

- - - - -


1 changed file:

- testsuite/driver/my_typing.py


Changes:

=====================================
testsuite/driver/my_typing.py
=====================================
@@ -10,16 +10,30 @@ The testsuite driver can be typechecked using mypy [1].
 
 try:
     from typing import *
+    import typing
 except:
     # The backwards compatibility stubs must live in another module lest
     # mypy complains.
     from typing_stubs import * # type: ignore
 
+
+####################################################
+# Backwards compatibility shims
+#
+# N.B. mypy appears to typecheck as though the "then" clause of if structures
+# is taken. We exploit this below.
+
+# TextIO is missing on some older Pythons.
+if 'TextIO' in globals():
+    TextIO = typing.TextIO
+else:
+    TextIO = None # type: ignore
+
+
+####################################################
+# Testsuite-specific types
+
 WayName = NewType("WayName", str)
 TestName = NewType("TestName", str)
 OutputNormalizer = Callable[[str], str]
 IssueNumber = NewType("IssueNumber", int)
-
-# TextIO is missing on some older Pythons.
-if 'TextIO' not in globals():
-    TextIO = None



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/69bd9f2e0f216c2c3a4dea4c0dad9c20dec939bf

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/69bd9f2e0f216c2c3a4dea4c0dad9c20dec939bf
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20190621/1ca880ae/attachment-0001.html>


More information about the ghc-commits mailing list