Skip to content
Snippets Groups Projects
Commit f92acd8e authored by Thomas Miedema's avatar Thomas Miedema Committed by thoughtpolice
Browse files

Dont call unsafeGlobalDynFlags if it is not set

Parsing of static and mode flags happens before any session is started,
i.e., before the first call to 'GHC.withGhc'. Therefore, to report
errors for invalid usage of these two types of flags, we can not call
any function that needs DynFlags, as there are no DynFlags available yet
(unsafeGlobalDynFlags is not set either). So we always print "on the
commandline" as the location, which is true except for Api users, which
is probably ok.

When reporting errors for invalid usage of dynamic flags we /can/ make
use of DynFlags, and we do so explicitly in
DynFlags.parseDynamicFlagsFull.

Before, we called unsafeGlobalDynFlags when an invalid (combination of)
flag(s) was given on the commandline, resulting in panics (#9963). This
regression was introduced in 1d6124de.

Also rename showSDocSimple to showSDocUnsafe, to hopefully prevent this
from happening again.

Reviewed By: austin

Differential Revision: https://phabricator.haskell.org/D730

GHC Trac Issues: #9963

(cherry picked from commit 5166ee94)
parent 67c30624
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment