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

Add error message to autofold #806

Merged
merged 12 commits into from
May 24, 2018
Merged

Add error message to autofold #806

merged 12 commits into from
May 24, 2018

Conversation

nomisRev
Copy link
Member

This closes #462

@JorgeCastilloPrz @raulraja As discussed in #766 I am not sure how we should proceed with throwing KnownException. I did a small spike with the scenario handled in this PR and had to rely on MonadError and Traverse for it to be somewhat manageable.

@nomisRev
Copy link
Member Author

@jereksel I tried adding some tests for the processor but ran into some issues. If I understand correctly I should.

  1. Add annotated targets to :arrow-annotation-processor-test-models
  2. Add expected generated result to arrow-annotation-processor/src/test/resources
  3. Add test under arrow-annotation-processor/src/test

Since @autofold generates extension functions I have a dependency on :arrow-annotation-processor-test-models in resources. This was not working for me.

Any ideas? Am I missing something?

@codecov
Copy link

codecov bot commented Apr 19, 2018

Codecov Report

Merging #806 into master will decrease coverage by 0.05%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #806      +/-   ##
============================================
- Coverage     44.71%   44.66%   -0.06%     
  Complexity      623      623              
============================================
  Files           298      298              
  Lines          7657     7669      +12     
  Branches        831      832       +1     
============================================
+ Hits           3424     3425       +1     
- Misses         3930     3942      +12     
+ Partials        303      302       -1
Impacted Files Coverage Δ Complexity Δ
...ssor/src/main/java/arrow/fold/AutoFoldProcessor.kt 0% <0%> (ø) 0 <0> (ø) ⬇️
.../src/main/java/arrow/fold/AutoFoldFileGenerator.kt 0% <0%> (ø) 0 <0> (ø) ⬇️
...ics/src/main/kotlin/arrow/optics/instances/mapk.kt 91.66% <0%> (+4.16%) 0% <0%> (ø) ⬇️

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 84dbd62...d6a7195. Read the comment docs.

@andrzejressel
Copy link
Contributor

@nomisRev Try removing "build" directory in models. When you add new classes kapt often doesn't transform them.

@raulraja
Copy link
Member

I think it's ok to throw exceptions since this should fail fast at compile time but I don't have an strong opinion since I'm actually more interested in removing the entire kapt API we use all together for something that wraps the Proto stuff which is tedious as hell to deal with. I'm also realizing that arrow-generic will provide also this same feature when we have @coproduct sealed ... since fold is one of the ops in @coproduct and soon will be in @product because of the HList <-> data class Iso.

Maybe then we should consider merging these processors and annotations to be part of arrow-generic

@nomisRev
Copy link
Member Author

@jereksel I doubled checked everything but still get FileNotFoundException. Although I can see the java stub under .../models/build/tmp/kapt3/stubs/main/arrow/ap/objects/autofold.

Test fail with following error java.io.FileNotFoundException: /var/folders/y6/3f_jn1qd2xg6kkgsnmf2_p680000gp/T/1524998582721-0/autofold (Is a directory)

I am unsure why it's trying to look in that location. Any ideas?

@andrzejressel
Copy link
Contributor

andrzejressel commented Apr 29, 2018

@nomisRev That means that AP passed fine, but checking of output file failed (this directory is for AP output files).

@nomisRev
Copy link
Member Author

@jereksel I have no clue how to make it find the directory. The same thing is done for Optics. I'd like to close this PR, if we cannot fix tests I prefer to remove them for now.

@nomisRev nomisRev merged commit 4c934ed into master May 24, 2018
@nomisRev nomisRev deleted the simon-autofold-error branch May 24, 2018 11:26
RawToast pushed a commit to RawToast/kategory that referenced this pull request Jul 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error message autofold
4 participants