Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split records of SymbolT and DefinitionS #384

Open
wants to merge 95 commits into
base: master
Choose a base branch
from

Commits on Oct 21, 2019

  1. Configuration menu
    Copy the full SHA
    c5fd565 View commit details
    Browse the repository at this point in the history
  2. Add instance Alt Maybe

    This is needed by the lenses to be added later.
    matil019 committed Oct 21, 2019
    Configuration menu
    Copy the full SHA
    f577108 View commit details
    Browse the repository at this point in the history
  3. [norun] Change SymbolT.SymT to an independent data type

    See frege/compiler/types/Symbols.fr
    
    As a first step to decomposing the sum-record SymbolT, SymT was isolated
    to an independent data type.
    
    Some parts of code were deliberately rewritten into refutable case
    analyses so that compiler warnings are triggered.
    matil019 committed Oct 21, 2019
    Configuration menu
    Copy the full SHA
    c4dfb23 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    73d651a View commit details
    Browse the repository at this point in the history
  5. Isolate all of SymbolT data constructors

    The field accessors of SymbolT were replaced with lenses.
    
    Partial functions were deliberately introduced to trigger compilation
    warnings where certain constructor is implicitly assumed (for example,
    an unsafe conversion `SymbolT g -> SymD g` is inserted to a piece of
    code which accesses `flds`, which exists only on `SymD`.)
    matil019 committed Oct 21, 2019
    Configuration menu
    Copy the full SHA
    504e178 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    e9fd748 View commit details
    Browse the repository at this point in the history
  7. Modify findV to return SymV, same for other Sym?s

    Lots of redundant unsafeToSymVs and its friends were removed.
    matil019 committed Oct 21, 2019
    Configuration menu
    Copy the full SHA
    1b872dc View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    7803c9e View commit details
    Browse the repository at this point in the history
  9. Remuve uses of unsafePartialView from frege.compiler.Kinds

    by tightening the types of parameters
    matil019 committed Oct 21, 2019
    Configuration menu
    Copy the full SHA
    5a0459a View commit details
    Browse the repository at this point in the history
  10. Reduce warnings on frege.tools.doc.Utilities

    - removed redundant pattern from `sref`
    - changed the type of `overSig` to take `SymV Global`
    matil019 committed Oct 21, 2019
    Configuration menu
    Copy the full SHA
    f83552d View commit details
    Browse the repository at this point in the history
  11. Remove uses of unsafePartialView from frege.compiler.passes.Imp

    By changing the type of the local function `rbSymT` to return `SymT`
    matil019 committed Oct 21, 2019
    Configuration menu
    Copy the full SHA
    8c03d3f View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    596b2e0 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    a4cb129 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    d9c176b View commit details
    Browse the repository at this point in the history
  15. Remove uses of partial functions in frege.compiler.passes.Instances

    by tightening the parameter types
    matil019 committed Oct 21, 2019
    Configuration menu
    Copy the full SHA
    d8ce200 View commit details
    Browse the repository at this point in the history
  16. Remove some of partial functions in frege.compiler.Classes

    by tightening the types of parameters
    matil019 committed Oct 21, 2019
    Configuration menu
    Copy the full SHA
    6f2e5a4 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    efac3c0 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    727656c View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    9caad72 View commit details
    Browse the repository at this point in the history
  20. Remove partial functions in frege.compiler.gen.java.Match

    by tightening the parameters
    matil019 committed Oct 21, 2019
    Configuration menu
    Copy the full SHA
    81e2594 View commit details
    Browse the repository at this point in the history
  21. Change the return type of allourvars and allvars to [SymV Global]

    allvars was changed from monadic value to a plain function because it
    doesn't change nay state.
    
    Some functions in other modules had their parameters tightened.
    matil019 committed Oct 21, 2019
    Configuration menu
    Copy the full SHA
    56e7ac8 View commit details
    Browse the repository at this point in the history
  22. Change fundep to take SymV

    matil019 committed Oct 21, 2019
    Configuration menu
    Copy the full SHA
    fb417c4 View commit details
    Browse the repository at this point in the history
  23. Change ccSym to take SymV

    matil019 committed Oct 21, 2019
    Configuration menu
    Copy the full SHA
    f0b8d1c View commit details
    Browse the repository at this point in the history
  24. Configuration menu
    Copy the full SHA
    8bef123 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    7809062 View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    daf9a49 View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    a316f7a View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    2c7fad5 View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    81a68d2 View commit details
    Browse the repository at this point in the history
  30. Remove unused imports

    matil019 committed Oct 21, 2019
    Configuration menu
    Copy the full SHA
    d1cbfc0 View commit details
    Browse the repository at this point in the history
  31. Configuration menu
    Copy the full SHA
    03611c1 View commit details
    Browse the repository at this point in the history

Commits on Oct 23, 2019

  1. Configuration menu
    Copy the full SHA
    4777ba6 View commit details
    Browse the repository at this point in the history
  2. Add Prism

    Ported from Haskell's profunctors and lens
    matil019 committed Oct 23, 2019
    Configuration menu
    Copy the full SHA
    e0d5f1e View commit details
    Browse the repository at this point in the history
  3. Add prisms for SymbolT

    Ad-hoc isSym? functions were replaced with the prisms.
    matil019 committed Oct 23, 2019
    Configuration menu
    Copy the full SHA
    f95bcb3 View commit details
    Browse the repository at this point in the history
  4. Introduce SymVal to constrain the return type of findVD

    SymVal is a sum type of SymV and SymD.
    matil019 committed Oct 23, 2019
    Configuration menu
    Copy the full SHA
    cdcb6db View commit details
    Browse the repository at this point in the history
  5. Modify Classes.implemented to take SymVal

    Because it can only take SymD and SymV.
    matil019 committed Oct 23, 2019
    Configuration menu
    Copy the full SHA
    86364a5 View commit details
    Browse the repository at this point in the history
  6. Remove a non-exhaustive case from passC.mkanno

    Non-exhaustive case analysis was done on a parameter 'msym :: Symbol'
    but that was done just before returning a value.
    So it was moved out of the function to the caller site, removing the
    need to match on Symbol.
    
    Also the parameter was changed to 'mpos :: Position' because 'mkanno'
    was only interested in 'pos' field.
    matil019 committed Oct 23, 2019
    Configuration menu
    Copy the full SHA
    63a8efc View commit details
    Browse the repository at this point in the history
  7. Remove unsafeToSymC from passC.methodcheck

    The symbols must be SymCs because they are looked up by QNames which
    belong to SymC.supers.
    matil019 committed Oct 23, 2019
    Configuration menu
    Copy the full SHA
    43de55b View commit details
    Browse the repository at this point in the history
  8. Remove a redundant pattern of tcInstMethod

    SymbolT.V is always matched by the second pattern because of
    'Lens.has SymbolT.typ msym', rendering the third one redundant.
    matil019 committed Oct 23, 2019
    Configuration menu
    Copy the full SHA
    eaaae98 View commit details
    Browse the repository at this point in the history
  9. Assume tcInstMethod takes either SymV or SymL

    Under that assumption, the non-exhaustive case was rewritten so that it
    becomes noop on uninterested cases.
    matil019 committed Oct 23, 2019
    Configuration menu
    Copy the full SHA
    a3f51fd View commit details
    Browse the repository at this point in the history

Commits on Oct 24, 2019

  1. Change the type of SymI.env to SymMeth

    SymMeth is a new data type which is a sum of SymL and SymV.
    SymI.env was renamed to SymI.meth and can now accept SymL and SymV only.
    
    The following functions now take SymMeth instead of Symbol. This change
    is considered safe because they threw runtime errors when receiving
    other than SymL or SymV.
    
    - frege.compiler.Classes.tcInstMethod
    - frege.compiler.gen.java.VarCode.varCode
    - frege.compiler.passes.Easy.checkDepth
    
    SymbolT.env' which is a generalization of .env and .meth is added and
    uses of SymbolT.env are replaced with SymbolT.env' where applicable.
    matil019 committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    037f1a8 View commit details
    Browse the repository at this point in the history
  2. Change the return type of classMethodOfInstMethod to SymV

    All of the call sites assume that.
    matil019 committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    58b9af7 View commit details
    Browse the repository at this point in the history
  3. Modify strictReturn to return SymVal

    strictReturn now uses SymVal (i.e. SymV|SymD) instead of Symbol,
    removing uses of partial functions.
    matil019 committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    e16d177 View commit details
    Browse the repository at this point in the history
  4. Add findMain, specialized to find the main function

    The call sites assumed (VName g.thisPack "main") pointed to a SymV (as
    it should be). It is now guaranteed by the type.
    matil019 committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    cab842a View commit details
    Browse the repository at this point in the history
  5. Use SymVal in substInst

    matil019 committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    e31e3d2 View commit details
    Browse the repository at this point in the history
  6. Use SymV in rHas

    matil019 committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    23933ec View commit details
    Browse the repository at this point in the history
  7. Modify passC.methodcheck to take SymMeth

    Its partialness remains same.
    matil019 committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    aaf425d View commit details
    Browse the repository at this point in the history
  8. Assume SymV in isEasy.Let

    I'm pretty sure that (Let.env :: [QName]) points to SymVs only.
    matil019 committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    1fdcc0c View commit details
    Browse the repository at this point in the history
  9. Assume SymV in etaExpand.cleanVarType

    I think Vbl.name refers to a SymV.
    matil019 committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    d698fae View commit details
    Browse the repository at this point in the history
  10. Change the type of Global.genEnv to [SymV Global]

    Only SymV were pushed into genEnv. Partial functions at some of the call
    sites were eliminated.
    matil019 committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    17905bd View commit details
    Browse the repository at this point in the history
  11. Assume the return type of instTSym and instTauSym to be SymT

    AFAICS almost all of the calling sites assume the return value is SymT.
    matil019 committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    e868594 View commit details
    Browse the repository at this point in the history
  12. Modify methCode and related functions to take SymV

    MethodCall.methCode assumed its Symbol parameter to be SymV.
    The other related functions, which could handle / were called with SymV
    only, were modified as well.
    matil019 committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    c973f5c View commit details
    Browse the repository at this point in the history
  13. Modify wrapIRMethod to take SymVal

    The partialness couldn't removed. It was moved to the call site.
    matil019 committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    38021a1 View commit details
    Browse the repository at this point in the history
  14. Remove use of unsafePartialView in symWarning

    It seems pointless to crash the compiler when a symbol can't have a
    documentation (i.e. it's a SymL). Instead it is ignored.
    matil019 committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    379359c View commit details
    Browse the repository at this point in the history
  15. Modify arity to take SymVal

    matil019 committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    1d5d778 View commit details
    Browse the repository at this point in the history
  16. Add a custom partial conversion SymbolT -> SymV in SymbolTable

    If a SymbolT's name is Local, it is converted to SymV.
    
    It is safe but it can't be proved by the type system until QName, the
    sum type, is split just like SymbolT.
    
    For now, the non-exclusive case analysis is replaced by a private unsafe
    conversion to supress unwanted compilation warnings.
    matil019 committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    f3992b8 View commit details
    Browse the repository at this point in the history
  17. Remove use of unsafePartialView in docWarningSym

    The same reasoning as symWarning. It is pointless to crash the compiler
    if a symbol is known not to be able to have a doc.
    matil019 committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    599465c View commit details
    Browse the repository at this point in the history

Commits on Oct 25, 2019

  1. Remove uses of unsafePartialView from passes.Final

    A new local function 'mapEnvSymV' that traverses Symbol.env was added to
    solve the issue.
    matil019 committed Oct 25, 2019
    Configuration menu
    Copy the full SHA
    1f5afaf View commit details
    Browse the repository at this point in the history
  2. Ignore missing SymbolT.env' in resolve3

    The same reasoning as symWarning. It is pointless to crash the compiler
    if a symbol is known not to be able to have an env-like thing.
    matil019 committed Oct 25, 2019
    Configuration menu
    Copy the full SHA
    59847a3 View commit details
    Browse the repository at this point in the history
  3. Ignore missing SymbolT.env' in enter1ClaDcl

    The same reasoning as symWarning. It is pointless to crash the compiler
    if a symbol is known not to be able to have an env-like thing.
    matil019 committed Oct 25, 2019
    Configuration menu
    Copy the full SHA
    f3f0c3a View commit details
    Browse the repository at this point in the history
  4. Remove uses of unsafePartialView in Transdef

    In transFunDcl, non-SymVals are just ignored.
    In ordInfix, non-SymVals will be treated as errors. (later)
    matil019 committed Oct 25, 2019
    Configuration menu
    Copy the full SHA
    749d6cc View commit details
    Browse the repository at this point in the history

Commits on Oct 30, 2019

  1. Configuration menu
    Copy the full SHA
    1a8fade View commit details
    Browse the repository at this point in the history
  2. Change the type of SymC.env to SymMeth

    SymC.env was renamed to SymC.meth and can now accept SymL and SymV only.
    
    The lens SymbolT.env was removed because SymT is the only type that has
    an 'env'.
    matil019 committed Oct 30, 2019
    Configuration menu
    Copy the full SHA
    3ac3df8 View commit details
    Browse the repository at this point in the history
  3. Replace a partial function in InstanceCode with a new error message

    lowerKindSpecialClasses has a partial function that cannot be avoided.
    The error case is an internal error (caused by bad frege.Prelude.List).
    matil019 committed Oct 30, 2019
    Configuration menu
    Copy the full SHA
    cdd5ba1 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    eba6356 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    5634a4f View commit details
    Browse the repository at this point in the history
  6. Remove a "may evaluate to false" warning in Classes.tcInstMethod

    A redundant guard which introduced that error was removed.
    matil019 committed Oct 30, 2019
    Configuration menu
    Copy the full SHA
    1df0181 View commit details
    Browse the repository at this point in the history
  7. Remove uses of unsafePartialView in Classes

    Instead of crashing, erroneous cases are simply treated as un-matched
    cases.
    matil019 committed Oct 30, 2019
    Configuration menu
    Copy the full SHA
    61f2681 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    6a60400 View commit details
    Browse the repository at this point in the history
  9. Remove uses of partial matches in VarCode

    Instead of crashing, erroneous cases are simply treated as un-matched
    cases.
    matil019 committed Oct 30, 2019
    Configuration menu
    Copy the full SHA
    c4c7736 View commit details
    Browse the repository at this point in the history
  10. Add a custom partial function in InstanceCode

    All SymMeths in SymC.meth should have been resolved to SymV in this
    phase (at least that's how I understand the code).
    
    An error here, if any, is an internal error, and is reported as a pure
    error to help find a bug in the compiler.
    matil019 committed Oct 30, 2019
    Configuration menu
    Copy the full SHA
    3b9cefb View commit details
    Browse the repository at this point in the history
  11. Add a custom partial function in Global

    Some functions in Global assumes certain propeties of Symbols. Those
    assumptions should be correct unless something goes very wrong.
    
    An error here, if any, is an internal error, and is reported as a pure
    error to help find a bug in the compiler.
    matil019 committed Oct 30, 2019
    Configuration menu
    Copy the full SHA
    da7ebcf View commit details
    Browse the repository at this point in the history
  12. Add an error message to the new error in SymbolTable

    Since only SymMeth (i.e. SymV or SymL) can be a member of SymC.meth or
    SymI.meth, if 'sym' is not SymMeth, it is an error.
    
    A new error message was added to report it instead of just crashing.
    matil019 committed Oct 30, 2019
    Configuration menu
    Copy the full SHA
    9effb28 View commit details
    Browse the repository at this point in the history
  13. Add a copy of unsafePartialView to MethodCall

    A part of MethodCall.nativeCall uses unsafePartialView a lot. The reason
    is that it was written by myself as a prototype and is not polished yet.
    matil019 committed Oct 30, 2019
    Configuration menu
    Copy the full SHA
    a9b0fa2 View commit details
    Browse the repository at this point in the history
  14. Remove uses of partial matches in doc.Utility

    Instead of crashing, erroneous cases are simply treated as un-matched
    cases.
    matil019 committed Oct 30, 2019
    Configuration menu
    Copy the full SHA
    afca4ce View commit details
    Browse the repository at this point in the history
  15. Remove uses of partial functions in tools.Doc

    'allfuns' now contain SymVs only. If non SymVs are in an env of a
    Symbol, they are just now ignored.
    
    Some of the other functions had their types changed in order to reflect
    that change.
    matil019 committed Oct 30, 2019
    Configuration menu
    Copy the full SHA
    a42eca7 View commit details
    Browse the repository at this point in the history
  16. Remove uses of partial matches in ide.Utilities

    Instead of crashing, erroneous cases are simply treated as un-matched
    cases.
    matil019 committed Oct 30, 2019
    Configuration menu
    Copy the full SHA
    e7908e5 View commit details
    Browse the repository at this point in the history
  17. Change SymbolTable.InsUpd to protected

    being "private" crashes fregedoc (but not fregec).
    matil019 committed Oct 30, 2019
    Configuration menu
    Copy the full SHA
    e01d94c View commit details
    Browse the repository at this point in the history
  18. Make constructors of SymbolT, SymMeth and SymVal strict

    optimizations from now on
    matil019 committed Oct 30, 2019
    Configuration menu
    Copy the full SHA
    4b83084 View commit details
    Browse the repository at this point in the history
  19. Clean unused imports

    Particularly unsafePartialView (defined in f.c.common.Lens) is no longer
    used anywhere.
    matil019 committed Oct 30, 2019
    Configuration menu
    Copy the full SHA
    e6f82dd View commit details
    Browse the repository at this point in the history
  20. Replace 'view'ing lenses with simple getters

    Added simple getters to SymbolT to be used instead of 'view'ing a
    'Lens'. In Haskell, 'view' can have significant overhead than simple
    pattern matching.
    
    The existing lenses were given a leading underscore, like the prisms.
    matil019 committed Oct 30, 2019
    Configuration menu
    Copy the full SHA
    46e2e2f View commit details
    Browse the repository at this point in the history
  21. Remove Prisms and use Traversals instead

    We don't use 'review', so Traversal is enough.
    Well, we do use 'is', but 'has' can be used for the purpose.
    
    Prism depends on Profunctor. In Haskell, the "profunctor" is a huge
    package. If, in some day, we port it to Frege, the compiler depending on
    it may be a problem.
    matil019 committed Oct 30, 2019
    Configuration menu
    Copy the full SHA
    750cc61 View commit details
    Browse the repository at this point in the history
  22. Replace 'view'ing lenses with simple getters for SymMeth and SymVal

    The same refactoring as done to SymbolT.
    
    Now all uses of 'view's were replaced by simple getters.
    
    This contributes to a big reduction of performance penalty.
    matil019 committed Oct 30, 2019
    Configuration menu
    Copy the full SHA
    98d630e View commit details
    Browse the repository at this point in the history
  23. Change the type of allClasses to StG [SymC Global]

    A redundant pattern match was removed.
    matil019 committed Oct 30, 2019
    Configuration menu
    Copy the full SHA
    2709dab View commit details
    Browse the repository at this point in the history

Commits on Oct 31, 2019

  1. Remove Utilities.symVD

    Unused partial function
    The new type SymVal and its member fromSymbol serves the same purpose.
    matil019 committed Oct 31, 2019
    Configuration menu
    Copy the full SHA
    d39551c View commit details
    Browse the repository at this point in the history
  2. Modify Desugar.updVis not to throw an error

    On invalid data constructor, 'updVis' behaves as 'id' instead of an
    error, just like 'over' in lens does.
    matil019 committed Oct 31, 2019
    Configuration menu
    Copy the full SHA
    a501df7 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    cfa58ac View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1ac6dad View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    389b789 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    49e0ca1 View commit details
    Browse the repository at this point in the history
  7. Change symInfo to take SymVal

    An error case in symInfo was eliminated. Related functions were altered
    to reflect this change. Most notably Global.GenSt.symi8 now have (SymVal
    Global) instead of Symbol as keys.
    
    A new error message was added to lowerKindSpecialClasses. It didn't make
    sense to pass SymL to lowerKindAbstractFun because it would eventually
    put into symi8 but never referenced because symInfo were never called
    with SymL.
    matil019 committed Oct 31, 2019
    Configuration menu
    Copy the full SHA
    8ec97a2 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    1952d83 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    d39d409 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    b2fec3f View commit details
    Browse the repository at this point in the history
  11. Clean up the code

    Removed unwanted diffs introduced by a series of modifications
    matil019 committed Oct 31, 2019
    Configuration menu
    Copy the full SHA
    11bdb3f View commit details
    Browse the repository at this point in the history