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

Support an integer type annotation argument #267

Merged
merged 5 commits into from May 12, 2018

Conversation

@kanghyojun
Copy link
Member

commented May 11, 2018

Support an integer type annotation argument which is one of the features that listed on #178. Since this is the blocker issue of #206, we can add constraints for integer types(int32, int64, bigint) after merging this PR.

However, I should create fixture.datetime.datetime-service, because all types except for a method of service couldn't compile the annotation. We have to compile the annotation of the unboxed type first to do #206.

Review, please :) @dahlia @Kroisse @AiOO.

@kanghyojun kanghyojun self-assigned this May 11, 2018

@kanghyojun kanghyojun requested review from dahlia, Kroisse and AiOO May 11, 2018

@kanghyojun kanghyojun changed the title Support an integer type annotation parameter Support an integer type annotation argument May 11, 2018

v <- many digitChar
case readMaybe v of
Just i -> return $ AInt i
Nothing -> fail "digit expected"

This comment has been minimized.

Copy link
@dahlia

dahlia May 11, 2018

Member

We could define a more general parser to take one or more digits and returns Integer, i.e., integer :: Parser Integer, and then make this annotationArgumentValue to utilize that.

@@ -20,7 +23,11 @@ import Nirum.Constructs (Construct (toCode))
import Nirum.Constructs.Docs
import Nirum.Constructs.Identifier (Identifier)

type AnnotationArgumentSet = M.Map Identifier T.Text
data AnnotationArgument = AText T.Text
| AInt Int

This comment has been minimized.

Copy link
@dahlia

dahlia May 11, 2018

Member
  • Int has a limits on its size (up to 0x1FFFFFFF). We'd better to use Integer instead.
  • Data constructors shouldn't be prefixed with A.

@kanghyojun kanghyojun force-pushed the kanghyojun:annotation-integer branch from e01f299 to 54224af May 12, 2018

@checkmate-bot

This comment has been minimized.

Copy link

commented May 12, 2018

Checklist 🤔

src/Nirum/Parser.hs

  • If a new reserved keyword is introduced, it has to be also added to reservedKeywords set in the Nirum.Constructs.Identifier module.
CHANGES.md Outdated
@@ -125,7 +125,14 @@ To be released.
import iso (country as iso-country);
import types (country);
~~~~~~~~
- Support an integer type annotation argument. [[#178], [#267]]

This comment has been minimized.

Copy link
@dahlia

dahlia May 12, 2018

Member

Please use the past tense.

@kanghyojun kanghyojun force-pushed the kanghyojun:annotation-integer branch 2 times, most recently from cdac2fa to 7941023 May 12, 2018

@codecov

This comment has been minimized.

Copy link

commented May 12, 2018

Codecov Report

Merging #267 into master will decrease coverage by 0.05%.
The diff coverage is 84.61%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #267      +/-   ##
==========================================
- Coverage   76.14%   76.08%   -0.06%     
==========================================
  Files          33       33              
  Lines        2452     2467      +15     
  Branches      131      132       +1     
==========================================
+ Hits         1867     1877      +10     
- Misses        454      458       +4     
- Partials      131      132       +1
Impacted Files Coverage Δ
src/Nirum/Parser.hs 87.4% <100%> (+0.05%) ⬆️
src/Nirum/Constructs/Docs.hs 94.73% <100%> (ø) ⬆️
src/Nirum/Constructs/Annotation/Internal.hs 77.27% <50%> (-6.94%) ⬇️
src/Nirum/Targets/Python.hs 89% <66.66%> (-0.25%) ⬇️
src/Nirum/Constructs/Annotation.hs 91.89% <80%> (-2.4%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 814f455...e1498ef. Read the comment docs.

@kanghyojun kanghyojun force-pushed the kanghyojun:annotation-integer branch from 7941023 to e1498ef May 12, 2018

@dahlia
dahlia approved these changes May 12, 2018

@kanghyojun kanghyojun merged commit 5633ee0 into nirum-lang:master May 12, 2018

4 checks passed

codecov/patch 84.61% of diff hit (target 76.14%)
Details
codecov/project Absolute coverage decreased by -0.05% but relative coverage increased by +8.47% compared to c348ade
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@dahlia dahlia added this to In progress in Sprint at Seoul in May 2018 May 12, 2018

@dahlia dahlia moved this from In progress to In review in Sprint at Seoul in May 2018 May 12, 2018

@dahlia dahlia referenced this pull request May 12, 2018
4 of 8 tasks complete

@kanghyojun kanghyojun moved this from In review to Delivered in Sprint at Seoul in May 2018 May 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
3 participants
You can’t perform that action at this time.